cms/corpus_module/corpus.module
author nowmad@23.1.168.192.in-addr.arpa
Fri, 06 Nov 2015 16:48:03 +0100
changeset 8 f95603fd2e18
parent 6 7ae41fc5b50b
child 9 cfee18a7f900
permissions -rw-r--r--
add baseStatic to APP env
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
     1
<?php
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
     2
define('CORPUS_URL', 'corpus');
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
     3
define('CORPUS_APP', 'app-client');
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
     4
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
     5
/**
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
     6
 * Implements hook_menu().
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
     7
 */
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
     8
function corpus_menu() {
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
     9
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    10
  $items[CORPUS_URL] = array(
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    11
    'title'             => 'Corpus de la Parole',
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    12
    'access callback'   => TRUE,
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    13
    'page callback'     => 'corpus_page',
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    14
    'type'              => MENU_CALLBACK
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    15
  );
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    16
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    17
  return $items;
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    18
}
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    19
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    20
/**
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    21
 * The page callback function. Loads the Ember app
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    22
 */
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    23
function corpus_page() {
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    24
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    25
 $app = CORPUS_APP;
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    26
 $path = drupal_get_path('module', 'corpus') . '/' . $app;
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    27
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    28
 $element = array(
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    29
   '#tag' => 'base', // The #tag is the html tag - <link />
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    30
   '#attributes' => array( // Set up an array of attributes inside the tag
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    31
     'href' => '/corpus/',
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    32
   ),
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    33
 );
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    34
 drupal_add_html_head($element, 'ember_init_base');
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    35
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    36
 $element = array(
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    37
   '#tag' => 'meta', // The #tag is the html tag - <link />
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    38
   '#attributes' => array( // Set up an array of attributes inside the tag
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    39
     'name' => 'app-client/config/environment',
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    40
     'content' => '%7B%22rootElement%22%3A%22%23corpus-app%22%2C%22modulePrefix%22%3A%22app-client%22%2C%22environment%22%3A%22production%22%2C%22baseURL%22%3A%22/corpus%22%2C%22locationType%22%3A%22auto%22%2C%22APP%22%3A%7B%22baseStatic%22%3A%22/modules/corpus/app-client/%22%2C%22name%22%3A%22app-client%22%2C%22version%22%3A%220.0.0+e8ebf770%22%7D%2C%22contentSecurityPolicyHeader%22%3A%22Content-Security-Policy-Report-Only%22%2C%22contentSecurityPolicy%22%3A%7B%22default-src%22%3A%22%27none%27%22%2C%22script-src%22%3A%22%27self%27%22%2C%22font-src%22%3A%22%27self%27%22%2C%22connect-src%22%3A%22%27self%27%22%2C%22img-src%22%3A%22%27self%27%22%2C%22style-src%22%3A%22%27self%27%22%2C%22media-src%22%3A%22%27self%27%22%7D%2C%22exportApplicationGlobal%22%3Afalse%7D'
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    41
   ),
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    42
 );
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    43
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    44
 drupal_add_html_head($element, 'ember_init');
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    45
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    46
 drupal_add_js("{$path}/assets/vendor.js");
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    47
 drupal_add_css("{$path}/assets/vendor.css");
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    48
 drupal_add_css("{$path}/assets/{$app}.css");
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    49
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    50
 drupal_add_js("{$path}/assets/{$app}.js", array('type' => 'file', 'scope' => 'footer'));
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    51
 // drupal_add_js("{$path}/dist/assets/{$app}.js");
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    52
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    53
 return "<div id='corpus-app'></div>";
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    54
}