Created
November 19, 2010 15:30
-
-
Save mareksotak/706643 to your computer and use it in GitHub Desktop.
Context UI Block
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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