cms/corpus_module/corpus.module
author Chloe Laisne <chloe.laisne@gmail.com>
Sun, 19 Jun 2016 23:58:21 +0200
changeset 193 64afd482ac71
parent 104 bd3747a1cd5f
permissions -rw-r--r--
/thematiques endpoint autocomplete design basic application colors
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');
17
ac3dc090e987 remove useless global var MODULE_NAME and update readme
nowmad@23.1.168.192.in-addr.arpa
parents: 11
diff changeset
     3
6
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
     4
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
     5
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
     6
/**
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
     7
 * Implements hook_menu().
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
     8
 */
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
     9
function corpus_menu() {
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    10
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    11
  $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
    12
    '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
    13
    'access callback'   => TRUE,
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    14
    '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
    15
    'type'              => MENU_CALLBACK
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
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    18
  return $items;
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
/**
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    22
 * 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
    23
 */
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    24
function corpus_page() {
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    25
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    26
 $app = CORPUS_APP;
17
ac3dc090e987 remove useless global var MODULE_NAME and update readme
nowmad@23.1.168.192.in-addr.arpa
parents: 11
diff changeset
    27
 $path = drupal_get_path('module', 'corpus') . '/' . $app;
6
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    28
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    29
 $element = array(
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    30
   '#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
    31
   '#attributes' => array( // Set up an array of attributes inside the tag
17
ac3dc090e987 remove useless global var MODULE_NAME and update readme
nowmad@23.1.168.192.in-addr.arpa
parents: 11
diff changeset
    32
     'href' => '/'.CORPUS_URL.'/',
6
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
 );
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    35
 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
    36
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    37
 $element = array(
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    38
   '#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
    39
   '#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
    40
     'name' => 'app-client/config/environment',
104
bd3747a1cd5f update Readme and change baseStatic value with php function in corpus.module
nowmad@23.1.168.192.in-addr.arpa
parents: 80
diff changeset
    41
     '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%22APP%22%3A%7B%22baseStatic%22%3A%22/'.drupal_get_path('module', 'corpus').'/app-client/%22%2C%22name%22%3A%22app-client%22%2C%22version%22%3A%220.0.0+%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%20%27unsafe-eval%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%3Atrue%7D'
6
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
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    45
 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
    46
80
6e0272a9b3ca add google treemap dependencies
nowmad@23.1.168.192.in-addr.arpa
parents: 79
diff changeset
    47
 drupal_add_js("https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1.1','packages':['treemap']}]}");
6
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    48
 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
    49
 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
    50
 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
    51
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    52
 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
    53
 // 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
    54
71
22d9719f1929 add class to the main div of the ember app to simplify css set up
nowmad@23.1.168.192.in-addr.arpa
parents: 17
diff changeset
    55
 return "<div id='corpus-app' class='corpus-app'></div>";
6
7ae41fc5b50b init corpus module ready to embed the ember app
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    56
}