Projet

Général

Profil

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

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

1
<?php
2

    
3
/**
4
 * Plugins are described by creating a $plugin array which will be used
5
 * by the system that includes this file.
6
 */
7
$plugin = array(
8
  'single' => TRUE,
9
  'title' => t('Node type description'),
10
  'icon' => 'icon_node.png',
11
  'description' => t('Node type description.'),
12
  'required context' => new ctools_context_required(t('Node'), 'node'),
13
  'category' => t('Node'),
14
);
15

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

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

    
37
  return $block;
38
}
39

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

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