You are here

function context_ui_block in Context 6.3

Same name and namespace in other branches
  1. 5 context_ui/context_ui.module \context_ui_block()
  2. 6 context_ui/context_ui.module \context_ui_block()
  3. 6.2 context_ui/context_ui.module \context_ui_block()

Implementation of hook_block().

1 string reference to 'context_ui_block'
context_update_6003 in ./context.install
Remove deprecated tables from context_ui.

File

context_ui/context_ui.module, line 41

Code

function context_ui_block($op = 'list', $delta = 0, $edit = array()) {
  switch ($op) {
    case 'list':
      $blocks = array();
      if (module_exists('jquery_ui') && module_exists('admin')) {
        $blocks['editor'] = array(
          'info' => t('Context editor'),
          'admin' => TRUE,
        );
      }
      if (module_exists('devel')) {
        $blocks['devel'] = array(
          'info' => t('Context inspector'),
          'admin' => TRUE,
        );
      }
      return $blocks;
    case 'view':
      switch ($delta) {
        case 'editor':
          if (user_access('administer site configuration') && strpos($_GET['q'], 'admin/build/context') === FALSE && ($contexts = context_active_contexts())) {
            return array(
              'subject' => t('Context editor'),
              'content' => drupal_get_form('context_ui_editor', $contexts),
            );
          }
          break;
        case 'devel':
          if (module_exists('devel') && ($all = context_get())) {
            return array(
              'subject' => t('Context inspector'),
              'content' => kdevel_print_object($all),
            );
          }
          break;
      }
      break;
  }
}