term.inc
Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 function panels_term_panels_contexts() {
00012 $args['term'] = array(
00013 'title' => t("Taxonomy term"),
00014 'description' => t('A single taxonomy term object.'),
00015 'context' => 'panels_context_create_term',
00016 'settings form' => 'panels_context_term_settings_form',
00017 'settings form validate' => 'panels_context_term_settings_form_validate',
00018 'keyword' => 'term',
00019 'no ui' => TRUE,
00020 'context name' => 'term',
00021 );
00022 return $args;
00023 }
00024
00025
00026
00027
00028
00029 function panels_context_create_term($empty, $data = NULL, $conf = FALSE) {
00030 $context = new panels_context('term');
00031 $context->plugin = 'term';
00032
00033 if ($empty) {
00034 return $context;
00035 }
00036
00037 if ($conf) {
00038 $data = taxonomy_get_term($data['tid']);
00039 }
00040
00041 if (!empty($data)) {
00042 $context->data = $data;
00043 $context->title = $data->name;
00044 $context->argument = $data->tid;
00045 return $context;
00046 }
00047 }
00048
00049 function panels_context_term_settings_form($conf, $external = FALSE) {
00050 $form = array();
00051 if ($external) {
00052 $form['external'] = array(
00053 '#type' => 'checkbox',
00054 '#default_value' => $conf['external'],
00055 '#title' => t('Require this context from an external source (such as a containing panel page).'),
00056 '#description' => t('If selected, term selection (below) will be ignored'),
00057 );
00058 }
00059 return $form;
00060 }
00061
00062
00063
00064
00065 function panels_context_term_settings_form_validate($form, $form_values) {
00066 }