Mercurial > hg > rr-repo
comparison sites/all/modules/quicktabs/plugins/QuickNodeContent.inc @ 6:a75ead649730
added biblio, admin_menu and reference modules
| author | danieleb <danielebarchiesi@me.com> |
|---|---|
| date | Fri, 20 Sep 2013 11:18:21 +0100 |
| parents | b74b41bb73f0 |
| children |
comparison
equal
deleted
inserted
replaced
| 5:d72257b2ddc2 | 6:a75ead649730 |
|---|---|
| 19 '#description' => t('The node ID of the node.'), | 19 '#description' => t('The node ID of the node.'), |
| 20 '#maxlength' => 10, | 20 '#maxlength' => 10, |
| 21 '#size' => 20, | 21 '#size' => 20, |
| 22 '#default_value' => isset($tab['nid']) ? $tab['nid'] : '', | 22 '#default_value' => isset($tab['nid']) ? $tab['nid'] : '', |
| 23 ); | 23 ); |
| 24 $form['node']['teaser'] = array( | 24 $entity_info = entity_get_info('node'); |
| 25 '#type' => 'checkbox', | 25 $view_modes = array(); |
| 26 '#title' => t('Teaser view'), | 26 foreach ($entity_info['view modes'] as $view_mode_name => $view_mode) { |
| 27 '#default_value' => isset($tab['teaser']) ? $tab['teaser'] : 0, | 27 $view_modes[$view_mode_name] = $view_mode['label']; |
| 28 ); | 28 } |
| 29 $form['node']['hide_title'] = array( | 29 $form['node']['view_mode'] = array( |
| 30 '#type' => 'select', | |
| 31 '#title' => t('View mode'), | |
| 32 '#options' => $view_modes, | |
| 33 '#default_value' => isset($tab['view_mode']) ? $tab['view_mode'] : 'full', | |
| 34 ); | |
| 35 $form['node']['hide_title'] = array( | |
| 30 '#type' => 'checkbox', | 36 '#type' => 'checkbox', |
| 31 '#title' => t('Hide the title of this node'), | 37 '#title' => t('Hide the title of this node'), |
| 32 '#default_value' => isset($tab['hide_title']) ? $tab['hide_title'] : 1, | 38 '#default_value' => isset($tab['hide_title']) ? $tab['hide_title'] : 1, |
| 33 ); | 39 ); |
| 34 return $form; | 40 return $form; |
| 42 if (!empty($args)) { | 48 if (!empty($args)) { |
| 43 // The args have been passed in from an ajax request. | 49 // The args have been passed in from an ajax request. |
| 44 // The first element of the args array is the qt_name, which we don't need | 50 // The first element of the args array is the qt_name, which we don't need |
| 45 // for this content type. | 51 // for this content type. |
| 46 array_shift($args); | 52 array_shift($args); |
| 47 list($item['nid'], $item['teaser'], $item['hide_title']) = $args; | 53 list($item['nid'], $item['view_mode'], $item['hide_title']) = $args; |
| 48 } | 54 } |
| 49 $output = array(); | 55 $output = array(); |
| 50 if (isset($item['nid'])) { | 56 if (isset($item['nid'])) { |
| 51 $node = node_load($item['nid']); | 57 $node = node_load($item['nid']); |
| 52 if (!empty($node)) { | 58 if (!empty($node)) { |
| 53 if (node_access('view', $node)) { | 59 if (node_access('view', $node)) { |
| 54 $buildmode = $item['teaser'] ? 'teaser' : 'full'; | 60 $buildmode = $item['view_mode']; |
| 55 $nstruct = node_view($node, $buildmode); | 61 $nstruct = node_view($node, $buildmode); |
| 56 if ($item['hide_title']) { | 62 if ($item['hide_title']) { |
| 57 $nstruct['#node']->title = NULL; | 63 $nstruct['#node']->title = NULL; |
| 58 } | 64 } |
| 59 $output = $nstruct; | 65 $output = $nstruct; |
| 65 } | 71 } |
| 66 return $output; | 72 return $output; |
| 67 } | 73 } |
| 68 | 74 |
| 69 public function getAjaxKeys() { | 75 public function getAjaxKeys() { |
| 70 return array('nid', 'teaser', 'hide_title'); | 76 return array('nid', 'view_mode', 'hide_title'); |
| 71 } | 77 } |
| 72 } | 78 } |
