Révision 950416da
Ajouté par Assos Assos il y a plus de 5 ans
drupal7/sites/all/modules/rules/modules/data.rules.inc | ||
---|---|---|
1 | 1 |
<?php |
2 | 2 |
|
3 | 3 |
/** |
4 |
* @file General data related rules integration |
|
4 |
* @file |
|
5 |
* General data related rules integration. |
|
5 | 6 |
* |
6 | 7 |
* @addtogroup rules |
8 |
* |
|
7 | 9 |
* @{ |
8 | 10 |
*/ |
9 | 11 |
|
... | ... | |
22 | 24 |
|
23 | 25 |
/** |
24 | 26 |
* Implements hook_rules_file_info() on behalf of the pseudo data module. |
27 |
* |
|
25 | 28 |
* @see rules_core_modules() |
26 | 29 |
*/ |
27 | 30 |
function rules_data_file_info() { |
... | ... | |
30 | 33 |
|
31 | 34 |
/** |
32 | 35 |
* Implements hook_rules_action_info() on behalf of the pseudo data module. |
36 |
* |
|
33 | 37 |
* @see rules_core_modules() |
34 | 38 |
*/ |
35 | 39 |
function rules_data_action_info() { |
... | ... | |
160 | 164 |
'type' => 'unknown', |
161 | 165 |
'label' => t('Value'), |
162 | 166 |
'optional' => TRUE, |
163 |
'description' => t('Optionally, specify the initial value of the variable.') |
|
167 |
'description' => t('Optionally, specify the initial value of the variable.'),
|
|
164 | 168 |
), |
165 | 169 |
), |
166 | 170 |
'provides' => array( |
... | ... | |
220 | 224 |
'label' => t('Value to convert'), |
221 | 225 |
'default mode' => 'selector', |
222 | 226 |
), |
223 |
// For to-integer conversion only. |
|
224 |
'rounding_behavior' => array( |
|
225 |
'type' => 'token', |
|
226 |
'label' => t('Rounding behavior'), |
|
227 |
'description' => t('The rounding behavior the conversion should use.'), |
|
228 |
'options list' => 'rules_action_data_convert_rounding_behavior_options', |
|
229 |
'restriction' => 'input', |
|
230 |
'default value' => 'round', |
|
231 |
'optional' => TRUE, |
|
232 |
), |
|
233 | 227 |
), |
234 | 228 |
'provides' => array( |
235 | 229 |
'conversion_result' => array( |
... | ... | |
312 | 306 |
else { |
313 | 307 |
// Change the data parameter to be not editable. |
314 | 308 |
$form['parameter']['data']['settings']['#access'] = FALSE; |
315 |
// TODO: improve display
|
|
309 |
// @todo Improve display.
|
|
316 | 310 |
$form['parameter']['data']['info'] = array( |
317 | 311 |
'#prefix' => '<p>', |
318 | 312 |
'#markup' => t('<strong>Selected data:</strong> %selector', array('%selector' => $element->settings['data:select'])), |
... | ... | |
338 | 332 |
} |
339 | 333 |
|
340 | 334 |
/** |
341 |
* Custom validate callback for entity create, add variable and data create |
|
342 |
* action. |
|
335 |
* Validate callback for entity create, add variable and data create actions. |
|
343 | 336 |
*/ |
344 | 337 |
function rules_action_create_type_validate($element) { |
345 | 338 |
if (!isset($element->settings['type'])) { |
... | ... | |
379 | 372 |
} |
380 | 373 |
} |
381 | 374 |
|
382 |
|
|
383 | 375 |
/** |
384 | 376 |
* Form alter callback for actions relying on the entity type or the data type. |
385 | 377 |
*/ |
... | ... | |
410 | 402 |
unset($form['submit']); |
411 | 403 |
unset($form['provides']); |
412 | 404 |
// Disable #ajax for the first step as it has troubles with lazy-loaded JS. |
413 |
// @todo: Re-enable once JS lazy-loading is fixed in core.
|
|
405 |
// @todo Re-enable once JS lazy-loading is fixed in core. |
|
414 | 406 |
unset($form['parameter']['type']['settings']['type']['#ajax']); |
415 | 407 |
unset($form['reload']['#ajax']); |
416 | 408 |
} |
... | ... | |
489 | 481 |
|
490 | 482 |
/** |
491 | 483 |
* Implements hook_rules_condition_info() on behalf of the pseudo data module. |
484 |
* |
|
492 | 485 |
* @see rules_core_modules() |
493 | 486 |
*/ |
494 | 487 |
function rules_data_condition_info() { |
... | ... | |
611 | 604 |
} |
612 | 605 |
|
613 | 606 |
/** |
607 |
* Asserts the bundle of entities, if it's compared. |
|
608 |
* |
|
614 | 609 |
* If the bundle is compared, add the metadata assertion so other elements |
615 | 610 |
* can make use of properties specific to the bundle. |
616 | 611 |
*/ |
617 | 612 |
function rules_condition_data_is_assertions($element) { |
618 |
// Assert the bundle of entities, if its compared. |
|
613 |
// Assert the bundle of entities, if it's compared.
|
|
619 | 614 |
if ($wrapper = $element->applyDataSelector($element->settings['data:select'])) { |
620 | 615 |
$info = $wrapper->info(); |
621 | 616 |
if (isset($info['parent']) && $info['parent'] instanceof EntityDrupalWrapper) { |
... | ... | |
655 | 650 |
else { |
656 | 651 |
// Change the data parameter to be not editable. |
657 | 652 |
$form['parameter']['data']['settings']['#access'] = FALSE; |
658 |
// TODO: improve display
|
|
653 |
// @todo Improve display.
|
|
659 | 654 |
$form['parameter']['data']['info'] = array( |
660 | 655 |
'#prefix' => '<p>', |
661 | 656 |
'#markup' => t('<strong>Selected data:</strong> %selector', array('%selector' => $element->settings['data:select'])), |
Formats disponibles : Unified diff
Weekly update of contrib modules