Révision 7e72b748
Ajouté par Assos Assos il y a plus de 6 ans
drupal7/sites/all/modules/ctools/plugins/contexts/token.inc | ||
---|---|---|
17 | 17 |
|
18 | 18 |
/** |
19 | 19 |
* Create a context from manual configuration. |
20 |
* |
|
21 |
* @param $empty |
|
22 |
* Unused. |
|
23 |
* @param $data |
|
24 |
* Unused. |
|
25 |
* @param $conf |
|
26 |
* Unused. |
|
27 |
* |
|
28 |
* @return ctools_context |
|
29 |
* A context of type token, with the plugin set appropriately. |
|
20 | 30 |
*/ |
21 | 31 |
function ctools_context_create_token($empty, $data = NULL, $conf = FALSE) { |
22 | 32 |
$context = new ctools_context('token'); |
... | ... | |
27 | 37 |
|
28 | 38 |
/** |
29 | 39 |
* Implementation of hook_ctools_context_convert_list(). |
40 |
* |
|
41 |
* @return array|NULL |
|
42 |
* An array of token type information, keyed by 'type:id', or NULL if |
|
43 |
* none found. |
|
30 | 44 |
*/ |
31 | 45 |
function ctools_context_token_convert_list() { |
32 | 46 |
$tokens = token_info(); |
47 |
// Initialise $list here? |
|
33 | 48 |
foreach ($tokens['types'] as $type => $type_info) { |
34 | 49 |
if (empty($type_info['needs-data'])) { |
35 | 50 |
$real_type = isset($type_info['type']) ? $type_info['type'] : $type; |
... | ... | |
46 | 61 |
} |
47 | 62 |
|
48 | 63 |
/** |
49 |
* Implementation of hook_ctools_context_converter_alter(). |
|
64 |
* Token conversion function: look up the token and return it's value. |
|
65 |
* |
|
66 |
* @param $context |
|
67 |
* Unused. |
|
68 |
* @param string $token |
|
69 |
* The name of the token. |
|
70 |
* |
|
71 |
* @return array|NULL |
|
72 |
* The token value, or NULL if not found. |
|
73 |
* |
|
74 |
* @see ctools_context_convert_context(). |
|
50 | 75 |
*/ |
51 | 76 |
function ctools_context_token_convert($context, $token) { |
52 | 77 |
$tokens = token_info(); |
... | ... | |
59 | 84 |
return $values[$token]; |
60 | 85 |
} |
61 | 86 |
} |
87 |
return NULL; |
|
62 | 88 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules