コード例 #1
0
 public function block($op = 'list', $delta = 'listing', $edit = array())
 {
     if ($op == 'list') {
         $blocks = parent::block('list');
         $blocks['toc'] = array('info' => t('Table of Contents'), 'weight' => 0, 'status' => 1, 'cache' => BLOCK_NO_CACHE, 'region' => 'right');
         return $blocks;
     } else {
         if ($op == 'view') {
             if ($delta == 'toc') {
                 // abort if we're not doing a node 'view' page
                 if (!iic_util_current_page_is_node_view()) {
                     return;
                 }
                 $node = iic_util_current_page_node();
                 if ($node && $node->type == 'pubnode') {
                     return array('subject' => t('Table of Contents'), 'content' => $node->toc);
                 }
             } else {
                 parent::block('view', $delta);
             }
             // else
             return NULL;
         }
     }
 }
コード例 #2
0
 public function associatedBlock()
 {
     // abort if we're not doing a node 'view' page
     if (!iic_util_current_page_is_node_view()) {
         return;
     }
     $node = iic_util_current_page_node();
     if ($node && association_check_type($node, $this->name)) {
         association_populate_node_associations($node);
         association_populate_node_associations($node, $this->name);
         $field = $this->name . '_associations';
         $nodes = $node->{$field};
         if (count($nodes)) {
             $links = array();
             foreach ($nodes as $n) {
                 $links[] = l($n->title, 'node/' . $n->nid, array());
             }
             return array('subject' => t('Associated !names', array('!names' => $this->displayNamePlural)), 'content' => theme('node_list', $links, '', $node->nid, user_access('edit own ' . $this->name), $nodes, $this->name, drupal_get_form('scfnode_form_add_association', $node->nid, $this->name)));
         }
     }
 }