Pull merge.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d7 / ctools-plugin / content-type.twig
1 <?php
2
3 /**
4  * @file
5  * {{ plugin_name }} content type plugin.
6  */
7
8 /**
9  * Plugin definition.
10  */
11 $plugin = array(
12   'single' => TRUE,
13   'title' => t('{{ plugin_name }}'),
14   'description' => t('{{ description }}'),
15 {% if context == 'Node' or context == 'User' %}
16   'required context' => new ctools_context_required(t('{{ context }}'), '{{ context|lower }}'),
17 {% elseif  context == 'Term' %}
18   'required context' => new ctools_context_required(t('{{ context }}'), array('term', 'taxonomy_term')),
19 {% endif %}
20   'category' => t('{{ category }}'),
21   'render callback' => '{{ machine_name }}_{{ plugin_machine_name }}_content_type_render',
22 );
23
24 /**
25  * Render callback.
26  */
27 function {{ machine_name }}_{{ plugin_machine_name }}_content_type_render($subtype, $conf, $panel_args, $context) {
28 {% if context != '-' %}
29
30   if (empty($context->data)) {
31     return;
32   }
33
34 {% endif %}
35 {% if context == 'Node' or context == 'Term' %}
36   ${{ context|lower }} = clone $context->data;
37 {% elseif  context == 'User' %}
38 {# Use $account variable to avoid confusion with the global $user object #}
39   $account = clone $context->data;
40 {% endif %}
41
42   // Build pane content.
43   $build = array(
44     '#markup' => 'Content placeholder.',
45   );
46
47   $block = new stdClass();
48   $block->module = '{{ machine_name }}';
49   $block->title = t('Title placeholder');
50   $block->content = $build;
51   return $block;
52 }