Definition in file book_parent.inc.
Go to the source code of this file.
Functions | |
| panels_book_parent_context ($context=NULL, $conf) | |
| panels_book_parent_panels_relationships () | |
| panels_book_parent_settings_form ($conf) | |
| panels_book_parent_context | ( | $ | context = NULL, |
|
| $ | conf | |||
| ) |
Return a new context based on an existing context
Definition at line 27 of file book_parent.inc.
References panels_context_create(), and panels_context_create_empty().
00027 { 00028 // If unset it wants a generic, unfilled context, which is just NULL 00029 if (empty($context->data)) { 00030 return panels_context_create_empty('node'); 00031 } 00032 00033 if (isset($context->data->parent)) { 00034 if ($conf['type'] == 'top') { 00035 // Search through the book tree to load the top level. 00036 $result = array('nid' => $context->data->nid, 'vid' => $context->data->vid, 'parent' => $context->data->parent); 00037 while (!empty($result['parent'])) { 00038 $result = db_fetch_array(db_query("SELECT * FROM {book} b INNER JOIN {node} n ON b.vid = n.nid WHERE b.nid = %d", $result['parent'])); 00039 } 00040 $nid = $result['nid']; 00041 } 00042 else { 00043 // Just load the parent book. 00044 $nid = $context->data->parent; 00045 } 00046 00047 if (!empty($nid)) { 00048 // load the node 00049 $node = node_load($nid); 00050 // Generate the context. 00051 return panels_context_create('node', $node); 00052 } 00053 } 00054 }
| panels_book_parent_panels_relationships | ( | ) |
Definition at line 11 of file book_parent.inc.
00011 { 00012 $args['book_parent'] = array( 00013 'title' => t("Book parent"), 00014 'keyword' => 'book_parent', 00015 'description' => t('Adds a book parent from a node context.'), 00016 'required context' => new panels_required_context(t('Node'), 'node'), 00017 'context' => 'panels_book_parent_context', 00018 'settings form' => 'panels_book_parent_settings_form', 00019 'settings form validate' => 'panels_book_parent_settings_form_validate', 00020 ); 00021 return $args; 00022 }
| panels_book_parent_settings_form | ( | $ | conf | ) |
Settings form for the relationship
Definition at line 59 of file book_parent.inc.
00059 { 00060 $form['type'] = array( 00061 '#type' => 'select', 00062 '#title' => t('Relationship type'), 00063 '#options' => array('parent' => t('Immediate parent'), 'top' => t('Top level book')), 00064 '#default_value' => $conf['type'], 00065 ); 00066 00067 return $form; 00068 }
1.5.6