panels_node_legacy.module File Reference

(1.1.2.13 2008/08/03 04:43:03 sdboyer)


Detailed Description

This module exposes nodes directly to the add content interface. The context system provides the same functionality with considerably more power, but this module is sufficient for some targeted use cases.

Definition in file panels_node_legacy.module.

Go to the source code of this file.

Functions

 panels_node_legacy_add ($id, $parents, $conf=array())
 panels_node_legacy_admin ()
 panels_node_legacy_content_types ()
 panels_node_legacy_edit ($id, $parents, $conf)
 panels_node_legacy_edit_validate ($form, $form_values)
 panels_node_legacy_menu ($may_cache)
 panels_node_legacy_render ($conf, $panel_args)
 panels_node_legacy_title ($conf)
 panels_node_panels_content_types ()


Function Documentation

panels_node_legacy_add ( id,
parents,
conf = array() 
)

Returns the form for a new node.

Definition at line 135 of file panels_node_legacy.module.

References panels_node_legacy_edit().

00135                                                                 {
00136   $form = panels_node_legacy_edit($id, $parents, $conf);
00137   $form['nid'] = array(
00138     '#prefix' => '<div class="no-float">',
00139     '#suffix' => '</div>',
00140     '#title' => t('Enter the title or NID of a post'),
00141     '#description' => t('To use a NID from the URL, you may use %0, %1, ..., %N to get URL arguments. Or use @0, @1, @2, ..., @N to use arguments passed into the panel.'),
00142     '#type' => 'textfield',
00143     '#maxlength' => 512,
00144     '#autocomplete_path' => 'panels/node/autocomplete',
00145     '#weight' => -10,
00146   );
00147   $form['validate_me'] = array('#type' => 'value', '#value' => TRUE);
00148   return $form;
00149 }

Here is the call graph for this function:

panels_node_legacy_admin (  ) 

Page callback for the very short admin page.

Definition at line 33 of file panels_node_legacy.module.

00033                                     {
00034   $output = '<p>';
00035   $output .= t('Panels legacy nodes does not have a normal administrative UI, such as panels pages or mini panels. With this module, users may add a node directly to a panel via the add content interface. They may then select this node using an auto-complete field. In general, this method of adding nodes to panes should be considered deprecated (especially by module developers implementing the Panels API) and is only retained to support updating sites that use this older method. Moving forward, it is recommended that the context system be used to embed nodes, as that is far more powerful and interesting.');
00036   $output .= t('However, certain modules which make use of Panels are dependent on this method of getting node context (often without the developer even being aware of it), so it is important to emphasize that you CAN leave this module enabled without negatively impacting your site.');
00037   $output .= '</p>';
00038   return $output;
00039 }

panels_node_legacy_content_types (  ) 

Return all content types available.

Definition at line 121 of file panels_node_legacy.module.

00121                                             {
00122   return array(
00123     'node' => array(
00124       'title' => t('Node content'),
00125       'icon' => 'icon_node.png',
00126       'description' => t('Add a node from your site as content.'),
00127       'category' => array(t('Custom'), -10),
00128     ),
00129   );
00130 }

panels_node_legacy_edit ( id,
parents,
conf 
)

Returns an edit form for the custom type.

Definition at line 154 of file panels_node_legacy.module.

Referenced by panels_node_legacy_add().

00154                                                        {
00155   $form['nid'] = array(
00156     '#type' => 'value',
00157     '#default_value' => $conf['nid'],
00158   );
00159   $form['teaser'] = array(
00160     '#title' => t('Teaser'),
00161     '#type' => 'checkbox',
00162     '#default_value' => $conf['teaser'],
00163     '#description' => t('Check here to show only the node teaser'),
00164   );
00165   $form['links'] = array(
00166     '#type' => 'checkbox',
00167     '#default_value' => $conf['links'],
00168     '#title' => t('Display links'),
00169     '#description' => t('Check here to display the links with the post.'),
00170   );
00171 
00172   $form['leave_node_title'] = array(
00173     '#type' => 'checkbox',
00174     '#default_value' => $conf['leave_node_title'],
00175     '#title' => t('Leave node title'),
00176     '#description' => t('Advanced: if checked, do not touch the node title; this can cause the node title to appear twice unless your theme is aware of this.'),
00177   );
00178   $form['identifier'] = array(
00179     '#type' => 'textfield',
00180     '#default_value' => $conf['identifier'],
00181     '#title' => t('Identifier'),
00182     '#description' => t('Whatever is placed here will appear in $node->panel_identifier to make it easier to theme a node or part of a node as necessary.'),
00183   );
00184 
00185   return $form;
00186 }

Here is the caller graph for this function:

panels_node_legacy_edit_validate ( form,
form_values 
)

Validate a node.

Definition at line 191 of file panels_node_legacy.module.

References panels_nid_autocomplete().

00191                                                                {
00192   if (!$form_values['validate_me']) {
00193     return;
00194   }
00195 
00196   if ($nid = panels_nid_autocomplete($form_values['nid'])) {
00197     form_set_value($form['nid'], $nid);
00198   } else {
00199     if (!preg_match('/^[@%]\d+$/', $form_values['nid'])) {
00200       form_error($form['nid'], t('Invalid node'));
00201     }
00202   }
00203 }

Here is the call graph for this function:

panels_node_legacy_menu ( may_cache  ) 

Implementation of hook_menu().

Definition at line 16 of file panels_node_legacy.module.

00016                                              {
00017   if ($may_cache) {
00018     $items[] = array(
00019       'path' => 'admin/panels/node-legacy',
00020       'title' => t('Legacy node panes'),
00021       'access' => user_access('access administration pages'),
00022       'type' => MENU_NORMAL_ITEM,
00023       'callback' => 'panels_node_legacy_admin',
00024       'description' => t('Information about the legacy node content type.'),
00025     );
00026     return $items;
00027   }
00028 }

panels_node_legacy_render ( conf,
panel_args 
)

Output function for the 'node' content type.

Outputs a node based on the module and delta supplied in the configuration.

Definition at line 65 of file panels_node_legacy.module.

00065                                                        {
00066   $nid = $conf['nid'];
00067   $block = new stdClass();
00068 
00069   foreach (explode('/', $_GET['q']) as $id => $arg) {
00070     $nid = str_replace("%$id", $arg, $nid);
00071   }
00072 
00073   foreach ($panel_args as $id => $arg) {
00074     $nid = str_replace("@$id", $arg, $nid);
00075   }
00076 
00077   // Support node translation
00078   if (module_exists('translation')) {
00079     if ($translation = module_invoke('translation', 'node_nid', $nid, $GLOBALS['locale'])) {
00080       $nid = $translation;
00081     }
00082   }
00083 
00084   if (!is_numeric($nid)) {
00085     return;
00086   }
00087 
00088   $node = node_load($nid);
00089   if (!node_access('view', $node)) {
00090     return;
00091   }
00092 
00093   if (node_access('update', $node)) {
00094     $block->admin_links['update'] = array(
00095       'title' => t('Edit node'),
00096       'alt' => t("Edit this node"),
00097       'href' => "node/$node->nid/edit",
00098       'query' => drupal_get_destination(),
00099     );
00100   }
00101 
00102   $block->module = 'node';
00103   $block->delta = $node->nid;
00104 
00105   $block->subject = $node->title;
00106 
00107   if (empty($conf['leave_node_title'])) {
00108     unset($node->title);
00109   }
00110   if (!empty($conf['identifier'])) {
00111     $node->panel_identifier = $conf['identifier'];
00112   }
00113 
00114   $block->content = node_view($node, $conf['teaser'], FALSE, $conf['links']);
00115   return $block;
00116 }

panels_node_legacy_title ( conf  ) 

Returns the administrative title for a node.

Definition at line 208 of file panels_node_legacy.module.

00208                                          {
00209   if (!is_numeric($conf['nid'])) {
00210     return t('Node loaded from @var', array('@var' => $conf['nid']));
00211   }
00212 
00213   $node = node_load($conf['nid']);
00214   if ($node) {
00215     return check_plain($node->title);
00216   }
00217   else {
00218     return t('Deleted/missing node @nid', array('@nid' => $conf['nid']));
00219   }
00220 }

panels_node_panels_content_types (  ) 

Implementation of hook_panels_content_types()

Definition at line 44 of file panels_node_legacy.module.

00044                                             {
00045   $items['node'] = array(
00046     'title' => t('Node'),
00047     'weight' => -10,
00048     'single' => TRUE,
00049     'content_types' => 'panels_node_legacy_content_types',
00050     'render callback' => 'panels_node_legacy_render',
00051     'add callback' => 'panels_node_legacy_add',
00052     'edit callback' => 'panels_node_legacy_edit',
00053     'title callback' => 'panels_node_legacy_title',
00054     'add validate callback' => 'panels_node_legacy_edit_validate',
00055     'edit validate callback' => 'panels_node_legacy_edit_validate',
00056   );
00057   return $items;
00058 }


Generated on Sun Feb 5 05:00:23 2012 for Panels 2 by  doxygen 1.5.6