/**
  * Register as a block plugin, even though this is a generic plugin.
  * This will allow the plugin to behave as a block plugin, i.e. to
  * have layout tasks performed on it.
  * @param $hookName string
  * @param $args array
  */
 function callbackLoadCategory($hookName, $args)
 {
     $category =& $args[0];
     $plugins =& $args[1];
     switch ($category) {
         case 'blocks':
             $this->import('CustomBlockPlugin');
             $journal =& Request::getJournal();
             if (!$journal) {
                 return false;
             }
             $blocks = $this->getSetting($journal->getId(), 'blocks');
             if (!is_array($blocks)) {
                 break;
             }
             $i = 0;
             foreach ($blocks as $block) {
                 $blockPlugin = new CustomBlockPlugin($block, $this->getName());
                 $plugins[$blockPlugin->getSeq()][$blockPlugin->getPluginPath() . $i++] =& $blockPlugin;
                 unset($blockPlugin);
             }
             break;
     }
     return false;
 }
 /**
  * Register as a block plugin, even though this is a generic plugin.
  * This will allow the plugin to behave as a block plugin, i.e. to
  * have layout tasks performed on it.
  * @param $hookName string
  * @param $args array
  */
 function callbackLoadCategory($hookName, $args)
 {
     $category =& $args[0];
     $plugins =& $args[1];
     switch ($category) {
         case 'blocks':
             $this->import('CustomBlockPlugin');
             $journal =& Request::getJournal();
             if (!$journal) {
                 return false;
             }
             $blocks = $this->getSetting($journal->getId(), 'blocks');
             if (!is_array($blocks)) {
                 break;
             }
             $i = 0;
             foreach ($blocks as $block) {
                 $blockPlugin = new CustomBlockPlugin($block, $this->getName());
                 // default the block to being enabled
                 if ($blockPlugin->getEnabled() !== false) {
                     $blockPlugin->setEnabled(true);
                 }
                 // default the block to the right sidebar
                 if (!is_numeric($blockPlugin->getBlockContext())) {
                     $blockPlugin->setBlockContext(BLOCK_CONTEXT_RIGHT_SIDEBAR);
                 }
                 $plugins[$blockPlugin->getSeq()][$blockPlugin->getPluginPath() . $i] =& $blockPlugin;
                 $i++;
                 unset($blockPlugin);
             }
             break;
     }
     return false;
 }
 /**
  * Register as a block plugin, even though this is a generic plugin.
  * This will allow the plugin to behave as a block plugin, i.e. to
  * have layout tasks performed on it.
  * @param $hookName string The name of the hook being invoked
  * @param $args array The parameters to the invoked hook
  */
 function callbackLoadCategory($hookName, $args)
 {
     $category =& $args[0];
     $plugins =& $args[1];
     $request =& $this->getRequest();
     switch ($category) {
         case 'blocks':
             // The system is registering block plugins
             $this->import('CustomBlockPlugin');
             // Ensure that there is a context (journal or press)
             $context = $request->getContext();
             if (!$context) {
                 return false;
             }
             // Load the custom blocks we have created
             $blocks = $this->getSetting($context->getId(), 'blocks');
             if (!is_array($blocks)) {
                 break;
             }
             // Loop through each custom block and register it
             $i = 0;
             foreach ($blocks as $block) {
                 $blockPlugin = new CustomBlockPlugin($block, $this->getName());
                 // Default the block to being enabled (for newly created blocks)
                 if ($blockPlugin->getEnabled() !== false) {
                     $blockPlugin->setEnabled(true);
                 }
                 // Default the block to the right sidebar (for newly created blocks)
                 if (!is_numeric($blockPlugin->getBlockContext())) {
                     $blockPlugin->setBlockContext(BLOCK_CONTEXT_RIGHT_SIDEBAR);
                 }
                 // Add the plugin to the list of registered plugins
                 $plugins[$blockPlugin->getSeq()][$blockPlugin->getPluginPath() . $i] =& $blockPlugin;
                 $i++;
                 unset($blockPlugin);
             }
             break;
     }
     return false;
 }