4 * Plugins are described by creating a $plugin array which will be used
5 * by the system that includes this file.
9 'title' => t('Node links'),
10 'icon' => 'icon_node.png',
11 'description' => t('Node links of the referenced node.'),
12 'required context' => new ctools_context_required(t('Node'), 'node'),
13 'category' => t('Node'),
15 'override_title' => FALSE,
16 'override_title_text' => '',
24 * Output function for the 'node' content type. Outputs a node
25 * based on the module and delta supplied in the configuration.
27 function ctools_node_links_content_type_render($subtype, $conf, $panel_args, $context) {
28 if (!empty($context) && empty($context->data)) {
32 $node = isset($context->data) ? clone($context->data) : NULL;
33 $block = new stdClass();
34 $block->module = 'node';
35 $block->delta = $node->nid;
38 $block->delta = 'placeholder';
39 $block->subject = t('Node title.');
40 $block->content = t('Node links go here.');
43 if (!empty($conf['identifier'])) {
44 $node->panel_identifier = $conf['identifier'];
47 $block->subject = $node->title;
48 node_build_content($node, $conf['build_mode']);
49 $block->content = $node->content['links'];
52 if (!empty($conf['link']) && $node) {
53 $block->title_link = "node/$node->nid";
59 * Returns an edit form for the custom type.
61 function ctools_node_links_content_type_edit_form($form, &$form_state) {
62 $conf = $form_state['conf'];
64 $form['link'] = array(
65 '#title' => t('Link title to node'),
66 '#type' => 'checkbox',
67 '#default_value' => $conf['link'],
68 '#description' => t('Check here to make the title link to the node.'),
71 $entity = entity_get_info('node');
72 $build_mode_options = array();
73 foreach ($entity['view modes'] as $mode => $option) {
74 $build_mode_options[$mode] = $option['label'];
77 $form['build_mode'] = array(
78 '#title' => t('Build mode'),
80 '#description' => t('Select a build mode for this node.'),
81 '#options' => $build_mode_options,
82 '#default_value' => $conf['build_mode'],
85 $form['identifier'] = array(
86 '#type' => 'textfield',
87 '#default_value' => $conf['identifier'],
88 '#title' => t('Identifier'),
89 '#description' => t('Whatever is placed here will appear in @identifier, to help theme node links displayed on the panel', array('@identifier' => $node->panel_identifier)),
95 function ctools_node_links_content_type_edit_form_submit($form, &$form_state) {
96 // Copy everything from our defaults.
97 foreach (array_keys($form_state['plugin']['defaults']) as $key) {
98 $form_state['conf'][$key] = $form_state['values'][$key];
102 function ctools_node_links_content_type_admin_title($subtype, $conf, $context) {
103 return t('"@s" links', array('@s' => $context->identifier));