Révision e4c061ad
Ajouté par Assos Assos il y a plus de 9 ans
drupal7/sites/all/modules/ctools/includes/context.inc | ||
---|---|---|
169 | 169 |
|
170 | 170 |
function select($contexts, $context) { |
171 | 171 |
if (!is_array($contexts)) { |
172 |
$contexts = array($contexts); |
|
172 |
if (is_object($contexts) && $contexts instanceof ctools_context) { |
|
173 |
$contexts = array($contexts->id => $contexts); |
|
174 |
} |
|
175 |
else { |
|
176 |
$contexts = array($contexts); |
|
177 |
} |
|
173 | 178 |
} |
174 | 179 |
|
175 | 180 |
// If we had requested a $context but that $context doesn't exist |
... | ... | |
328 | 333 |
$title = $num ? t('Context %count', array('%count' => $num)) : t('Context'); |
329 | 334 |
} |
330 | 335 |
|
331 |
return array(
|
|
336 |
$form = array(
|
|
332 | 337 |
'#type' => 'select', |
333 | 338 |
'#options' => $options, |
334 | 339 |
'#title' => $title, |
335 | 340 |
'#default_value' => $default, |
336 | 341 |
); |
337 | 342 |
} |
343 |
|
|
344 |
return $form; |
|
338 | 345 |
} |
339 | 346 |
|
340 | 347 |
/** |
... | ... | |
1587 | 1594 |
$required_context = isset($plugin['required context']) ? $plugin['required context'] : array(); |
1588 | 1595 |
$context = isset($test['context']) ? $test['context'] : array(); |
1589 | 1596 |
$contexts = ctools_context_select($contexts, $required_context, $context); |
1590 |
$function($test['settings'], $contexts); |
|
1597 |
if ($contexts !== FALSE) { |
|
1598 |
$function($test['settings'], $contexts); |
|
1599 |
} |
|
1591 | 1600 |
} |
1592 | 1601 |
} |
1593 | 1602 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules