Projet

Général

Profil

Paste
Télécharger (1,42 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / ctools / plugins / content_types / node_context / node_type_desc.inc @ c304a780

1
<?php
2

    
3
/**
4
 * @file
5
 * Plugins are described by creating a $plugin array which will be used
6
 * by the system that includes this file.
7
 */
8

    
9
$plugin = array(
10
  'single' => TRUE,
11
  'title' => t('Node type description'),
12
  'icon' => 'icon_node.png',
13
  'description' => t('Node type description.'),
14
  'required context' => new ctools_context_required(t('Node'), 'node'),
15
  'category' => t('Node'),
16
);
17

    
18
/**
19
 * Output function for the 'node' content type. Outputs a node
20
 * based on the module and delta supplied in the configuration.
21
 */
22
function ctools_node_type_desc_content_type_render($subtype, $conf, $panel_args, $context) {
23
  $node = isset($context->data) ? clone $context->data : NULL;
24
  $block = new stdClass();
25
  $block->module = 'node_type';
26

    
27
  if ($node) {
28
    $type           = node_type_get_type($node);
29
    $block->title   = $type->name;
30
    $block->content = filter_xss_admin($type->description);
31
    $block->delta   = $node->type;
32
  }
33
  else {
34
    $block->title   = t('Node type description');
35
    $block->content = t('Node type description goes here.');
36
    $block->delta   = 'unknown';
37
  }
38

    
39
  return $block;
40
}
41

    
42
function ctools_node_type_desc_content_type_admin_title($subtype, $conf, $context) {
43
  return t('"@s" type description', array('@s' => $context->identifier));
44
}
45

    
46
function ctools_node_type_desc_content_type_edit_form($form, &$form_state) {
47
  // Provide a blank form so we have a place to have context setting.
48
  return $form;
49
}