Definition in file vid.inc.
Go to the source code of this file.
Functions | |
| panels_vid_choose_display ($conf, $context) | |
| panels_vid_context ($arg=NULL, $conf=NULL, $empty=FALSE) | |
| panels_vid_displays ($conf, $id) | |
| panels_vid_panels_arguments () | |
| panels_vid_settings_form ($conf) | |
| panels_vid_settings_form_submit (&$values) | |
| panels_vid_choose_display | ( | $ | conf, | |
| $ | context | |||
| ) |
Based upon the settings and the context, choose which display to use.
Definition at line 111 of file vid.inc.
00111 { 00112 if (empty($context->data)) { 00113 return; 00114 } 00115 00116 if (!empty($conf['displays'][$context->data->vid])) { 00117 return $context->data->vid; 00118 } 00119 00120 // Empty return says to use the default display. 00121 return; 00122 }
| panels_vid_context | ( | $ | arg = NULL, |
|
| $ | conf = NULL, |
|||
| $ | empty = FALSE | |||
| ) |
Discover if this argument gives us the vocabulary we crave.
Definition at line 28 of file vid.inc.
References panels_context_create(), and panels_context_create_empty().
00028 { 00029 // If unset it wants a generic, unfilled context. 00030 if ($empty) { 00031 return panels_context_create_empty('vocabulary'); 00032 } 00033 00034 if (!is_numeric($arg)) { 00035 return FALSE; 00036 } 00037 00038 $vocabulary = taxonomy_get_vocabulary($arg); 00039 if (!$vocabulary) { 00040 return FALSE; 00041 } 00042 00043 return panels_context_create('vocabulary', $vocabulary); 00044 }
| panels_vid_displays | ( | $ | conf, | |
| $ | id | |||
| ) |
What additional displays does this argument provide?
Definition at line 87 of file vid.inc.
00087 { 00088 $displays = array(); 00089 00090 if (is_array($conf['displays'])) { 00091 $options = array(); 00092 foreach (taxonomy_get_vocabularies() as $vid => $info) { 00093 $options[$vid] = $info->name; 00094 } 00095 foreach (array_keys(array_filter($conf['displays'])) as $vid) { 00096 $displays[$vid] = array( 00097 'title' => t('vocabulary ID @id @type', array('@id' => $id, '@type' => $options[$vid])), 00098 // Tell it to base the template for this display off of the default. 00099 'default' => 'default', 00100 'context' => 'vocabulary', 00101 ); 00102 } 00103 } 00104 00105 return $displays; 00106 }
| panels_vid_panels_arguments | ( | ) |
Definition at line 10 of file vid.inc.
00010 { 00011 $args['vid'] = array( 00012 'title' => t("Vocabulary ID"), 00013 // keyword to use for %substitution 00014 'keyword' => 'vocabulary', 00015 'description' => t('Loads a vocabulary object from the argument.'), 00016 'context' => 'panels_vid_context', 00017 'settings form' => 'panels_vid_settings_form', 00018 'settings form submit' => 'panels_vid_settings_form_submit', 00019 'displays' => 'panels_vid_displays', 00020 'choose display' => 'panels_vid_choose_display', 00021 ); 00022 return $args; 00023 }
| panels_vid_settings_form | ( | $ | conf | ) |
Settings form for the argument
Definition at line 49 of file vid.inc.
00049 { 00050 $options = array(); 00051 foreach (taxonomy_get_vocabularies() as $vid => $voc) { 00052 $options[$vid] = $voc->name; 00053 } 00054 00055 $form['displays'] = array( 00056 '#title' => t('Own display'), 00057 '#type' => 'checkboxes', 00058 '#options' => $options, 00059 '#default_value' => $conf['displays'], 00060 '#description' => t('Each checked vocabulary will get its own special display to layout its content.'), 00061 '#prefix' => '<div class="clear-block">', 00062 '#suffix' => '</div>', 00063 ); 00064 00065 return $form; 00066 }
| panels_vid_settings_form_submit | ( | &$ | values | ) |
There appears to be a bit of a bug with the way we're handling forms; it causes 'checkboxes' to get invalid values added to them when empty. This takes care of that.
Definition at line 73 of file vid.inc.
00073 { 00074 $vocs = taxonomy_get_vocabularies(); 00075 if (!empty($values['displays'])) { 00076 foreach ($values['displays'] as $vid => $value) { 00077 if (empty($vocs[$vid])) { 00078 unset($values['displays'][$vid]); 00079 } 00080 } 00081 } 00082 }
1.5.6