Révision 13c3c9b4
Ajouté par Assos Assos il y a environ 9 ans
drupal7/sites/all/modules/advanced_forum/plugins/contexts/forum.inc | ||
---|---|---|
2 | 2 |
|
3 | 3 |
/** |
4 | 4 |
* @file |
5 |
* |
|
6 | 5 |
* Plugin to provide a user context |
7 | 6 |
*/ |
7 |
|
|
8 | 8 |
/** |
9 | 9 |
* Plugins are described by creating a $plugin array which will be used |
10 | 10 |
* by the system that includes this file. |
... | ... | |
28 | 28 |
/** |
29 | 29 |
* Create a context, either from manual configuration or from an argument on the URL. |
30 | 30 |
* |
31 |
* @param $empty |
|
31 |
* @param bool $empty
|
|
32 | 32 |
* If true, just return an empty context. |
33 |
* @param $data |
|
33 |
* |
|
34 |
* @param array|null $data |
|
34 | 35 |
* If from settings form, an array as from a form. If from argument, a string. |
35 |
* @param $conf |
|
36 |
* |
|
37 |
* @param array|bool $conf |
|
36 | 38 |
* TRUE if the $data is coming from admin configuration, FALSE if it's from a URL arg. |
37 | 39 |
* |
38 |
* @return |
|
39 |
* a Context object/
|
|
40 |
* @return object.
|
|
41 |
* a Context object.
|
|
40 | 42 |
*/ |
41 | 43 |
function advanced_forum_forum_context_create_forum($empty, $data = NULL, $conf = FALSE) { |
42 | 44 |
$context = new ctools_context(array('forum', 'term')); |
... | ... | |
71 | 73 |
} |
72 | 74 |
} |
73 | 75 |
|
76 |
/** |
|
77 |
* Context settings form. |
|
78 |
*/ |
|
74 | 79 |
function advanced_forum_forum_context_settings_form($form, &$form_state) { |
75 | 80 |
$conf = $form_state['conf']; |
76 | 81 |
|
... | ... | |
108 | 113 |
switch ($type) { |
109 | 114 |
case 'tid': |
110 | 115 |
return $context->data->tid; |
116 |
|
|
111 | 117 |
case 'name': |
112 | 118 |
$forum_term = $context->data; |
113 | 119 |
|
114 |
if (module_exists('i18n_taxonomy')) |
|
120 |
if (module_exists('i18n_taxonomy')) {
|
|
115 | 121 |
$forum_term = i18n_taxonomy_localize_terms($forum_term); |
122 |
} |
|
116 | 123 |
|
117 | 124 |
return $forum_term->name; |
118 | 125 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules