context.install

Go to the documentation of this file.
00001 <?php
00002 
00003 /**
00004  * Implementation of hook_install().
00005  */
00006 function context_install() {
00007   // Nothing todo...
00008 }
00009 
00010 /**
00011  * Implementation of hook_uninstall().
00012  */
00013 function context_uninstall() {
00014   drupal_uninstall_schema('context');
00015   variable_del('context_ui_show_empty_regions');
00016   variable_del('context_reaction_block_disable_core');
00017   variable_del('context_reaction_block_all_regions');
00018 }
00019 
00020 /**
00021  * Implementation of hook_schema().
00022  */
00023 function context_schema() {
00024   $schema = array();
00025   $schema['context'] = array(
00026     'description' => 'Storage for normal (user-defined) contexts.',
00027     'export' => array(
00028       'key' => 'name',
00029       'identifier' => 'context',
00030       'default hook' => 'context_default_contexts',  // Function hook name.
00031       'status' => 'context_status',
00032       'api' => array(
00033         'owner' => 'context',
00034         'api' => 'context',  // Base name for api include files.
00035         'minimum_version' => 3,
00036         'current_version' => 3,
00037       ),
00038       'export callback' => 'context_export',
00039     ),
00040     'fields' => array(
00041       'name' => array(
00042         'description' => 'The primary identifier for a context.',
00043         'type' => 'varchar',
00044         'length' => 255,
00045         'not null' => TRUE,
00046         'default' => '',
00047       ),
00048       'description' => array(
00049         'description' => 'Description for this context.',
00050         'type' => 'varchar',
00051         'length' => 255,
00052         'not null' => TRUE,
00053         'default' => '',
00054       ),
00055       'tag' => array(
00056         'description' => 'Tag for this context.',
00057         'type' => 'varchar',
00058         'length' => 255,
00059         'not null' => TRUE,
00060         'default' => '',
00061       ),
00062       'conditions' => array(
00063         'description' => 'Serialized storage of all context condition settings.',
00064         'type' => 'text',
00065         'serialize' => TRUE,
00066       ),
00067       'reactions' => array(
00068         'description' => 'Serialized storage of all context reaction settings.',
00069         'type' => 'text',
00070         'serialize' => TRUE,
00071       ),
00072       'condition_mode' => array(
00073         'description' => 'Condition mode for this context.',
00074         'type' => 'int',
00075         'default' => 0,
00076       ),
00077     ),
00078     'primary key' => array('name'),
00079   );
00080   return $schema;
00081 }
00082 
00083 /**
00084  * Update 7000: Handle adjustments to split of theme reaction to support D7 preprocess split between _page and _html
00085  */
00086 
00087 function context_update_7000() {
00088   drupal_load('module', 'ctools');
00089   drupal_load('module', 'context');
00090   $updated = array();
00091   $contexts = context_load(NULL, TRUE);
00092   foreach ($contexts as $c) {
00093     // if the old data is in the old reaction and the new reaction hasn't been saved, migrate the old data to the new reaction
00094     if (isset($c->reactions['theme']) &&
00095         isset($c->reactions['theme']['class']) &&
00096         !empty($c->reactions['theme']['class']) &&
00097         !isset($c->reactions['theme_html'])
00098     ) {
00099       $c->reactions['theme_html']['class'] = $c->reactions['theme']['class'];
00100       context_save($c);
00101       $updated[] = $c->name;
00102     }
00103   }
00104   if (empty($updated)) {
00105     $ret = t('No contexts requiring migration detected');
00106   }
00107   else {
00108     $ret = t('The following contexts had theme reaction data migrated: @names', array('@names' => join(', ', $updated)));
00109   }
00110   return $ret;
00111 }

Generated on Wed Jun 19 02:24:08 2013 for Context by  doxygen 1.4.7