You are here

function context_ui_page_alter in Context 7.3

Implementation of hook_page_alter().

If we have the dialog enabled and active build the dialog and add to the page

File

context_ui/context_ui.module, line 337

Code

function context_ui_page_alter(&$page) {
  $contexts = context_active_contexts();
  if (context_ui_dialog_is_enabled() && context_isset('context_ui', 'context_ui_editor_present')) {
    $contexts = context_active_contexts();
    $form = drupal_get_form('context_ui_editor', $contexts);
    $path = drupal_get_path('module', 'context_ui');
    drupal_add_library('system', 'ui.dialog');
    drupal_add_js($path . '/context_ui_dialog.js', array(
      'type' => 'file',
      'weight' => 50,
    ));
    drupal_add_css($path . '/context_ui_dialog.css');

    //figure out which region to put it in - allow it to be configured for themes using different regions
    $placement = variable_get('context_ui_editor_block_region', 'content');
    $page[$placement]['context_ui_editor'] = array(
      0 => array(
        '#type' => 'markup',
        '#markup' => '<div style="display:none;" id="context_ui_dialog-context-ui">' . drupal_render($form) . '<!--[if IE 8 ]><div id="context_ui_dialog-shadow"></div><![endif]--></div>',
      ),
    );
  }
}