Skip to content

Instantly share code, notes, and snippets.

@mareksotak
Created November 19, 2010 15:30
Show Gist options
  • Save mareksotak/706643 to your computer and use it in GitHub Desktop.
Save mareksotak/706643 to your computer and use it in GitHub Desktop.
Context UI Block
/**
* Implementation of hook_block().
*/
function mymodule_block($op = 'list', $delta = 0, $edit = array()) {
switch ($op) {
case 'list':
$blocks = array();
if (module_exists('jquery_ui') && module_exists('context')) {
$blocks['editor'] = array('info' => t('One Context editor'), '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;
}
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment