'Node panes', 'access arguments' => array('access administration pages'), 'type' => MENU_NORMAL_ITEM, 'page callback' => 'panels_node_content_admin', 'description' => 'Information about the content node content type.', ); return $items; } /** * Page callback for the very short admin page. */ function panels_node_content_admin() { $output = '
'; $output .= t('Panels node panes 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.'); $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.'); $output .= '
'; return $output; } /** * Implementation of hook_panels_content_types() */ function panels_node_panels_content_types() { $items['node'] = array( 'title' => t('Node'), 'weight' => -10, 'single' => TRUE, 'content_types' => 'panels_node_content_content_types', 'render callback' => 'panels_node_content_render', 'add callback' => 'panels_node_content_add', 'edit callback' => 'panels_node_content_edit', 'title callback' => 'panels_node_content_title', 'add validate callback' => 'panels_node_content_edit_validate', 'edit validate callback' => 'panels_node_content_edit_validate', ); return $items; } /** * Output function for the 'node' content type. * * Outputs a node based on the module and delta supplied in the configuration. */ function panels_node_content_render($subtype, $conf, $panel_args) { $nid = $conf['nid']; $block = new stdClass(); foreach (explode('/', $_GET['q']) as $id => $arg) { $nid = str_replace("%$id", $arg, $nid); } foreach ($panel_args as $id => $arg) { $nid = str_replace("@$id", $arg, $nid); } // Support node translation if (module_exists('translation')) { if ($translations = module_invoke('translation', 'node_get_translations', $nid )) { if( $translations[$GLOBALS['language']->language] ) { $nid = $translations[$GLOBALS['language']->language]->nid; } } } if (!is_numeric($nid)) { return; } $node = node_load($nid); if (!node_access('view', $node)) { return; } if (node_access('update', $node)) { $block->admin_links['update'] = array( 'title' => t('Edit node'), 'alt' => t("Edit this node"), 'href' => "node/$node->nid/edit", 'query' => drupal_get_destination(), ); } $block->module = 'node'; $block->delta = $node->nid; $block->subject = $node->title; if (empty($conf['leave_node_title'])) { unset($node->title); } if (!empty($conf['identifier'])) { $node->panel_identifier = $conf['identifier']; } $block->content = node_view($node, $conf['teaser'], FALSE, $conf['links']); return $block; } /** * Return all content types available. */ function panels_node_content_content_types() { return array( 'node' => array( 'title' => t('Node content'), 'icon' => 'icon_node.png', 'description' => t('Add a node from your site as content.'), 'category' => array(t('Custom'), -10), ), ); } /** * Returns the form for a new node. */ function panels_node_content_add($id, $parents, $conf = array()) { $form = panels_node_content_edit($id, $parents, $conf); $form['nid'] = array( '#prefix' => '