Projet

Général

Profil

Révision 7e72b748

Ajouté par Assos Assos il y a plus de 6 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/ctools/ctools_plugin_example/plugins/contexts/simplecontext.inc
1 1
<?php
2 2

  
3

  
4 3
/**
5 4
 * @file
6 5
 * Sample ctools context type plugin that shows how to create a context from an arg.
7
 *
8 6
 */
9 7

  
10 8
/**
......
14 12
$plugin = array(
15 13
  'title' => t("Simplecontext"),
16 14
  'description' => t('A single "simplecontext" context, or data element.'),
17
  'context' => 'ctools_plugin_example_context_create_simplecontext',  // func to create context
15
// Func to create context.
16
  'context' => 'ctools_plugin_example_context_create_simplecontext',
18 17
  'context name' => 'simplecontext',
19 18
  'settings form' => 'simplecontext_settings_form',
20 19
  'keyword' => 'simplecontext',
......
69 68
    // This is used for keyword.
70 69
    $context->title = $data;
71 70
    $context->argument = $data;
72
    // Make up a bogus context
71
    // Make up a bogus context.
73 72
    $context->data = new stdClass();
74 73
    $context->data->item1 = t("Item1");
75 74
    $context->data->item2 = t("Item2");
......
102 101
  return $form;
103 102
}
104 103

  
105

  
106

  
107 104
/**
108 105
 * Provide a list of sub-keywords.
109 106
 *
......
125 122
  switch ($type) {
126 123
    case 'item1':
127 124
      return $context->data->item1;
125

  
128 126
    case 'item2':
129 127
      return $context->data->item2;
128

  
130 129
    case 'description':
131 130
      return $context->data->description;
132 131
  }
133 132
}
134

  

Formats disponibles : Unified diff