class RulesConditionalCaseUI in Conditional Rules 7
Same name and namespace in other branches
- 8 includes/rules_conditional.ui.inc \RulesConditionalCaseUI
UI for supporting option lists in the case value.
Hierarchy
- class \RulesPluginUI extends \FacesExtender implements RulesPluginUIInterface
- class \RulesContainerPluginUI
- class \RulesConditionalPluginUI
- class \RulesConditionalCaseUI
- class \RulesConditionalPluginUI
- class \RulesContainerPluginUI
Expanded class hierarchy of RulesConditionalCaseUI
1 string reference to 'RulesConditionalCaseUI'
- rules_conditional_rules_plugin_info in ./
rules_conditional.rules.inc - Implements hook_rules_plugin_info().
File
- includes/
rules_conditional.ui.inc, line 138 - Plugin UI implementation.
View source
class RulesConditionalCaseUI extends RulesConditionalPluginUI {
public function form(&$form, &$form_state, $options = array(), $iterator = NULL) {
// TODO Remove when http://drupal.org/node/1676998 is fixed.
$baseCount = count(explode('/', RulesPluginUI::$basePath));
$op = arg($baseCount + 2);
if ($op == 'add') {
// Redirect to extended path.
$pathAddPredicate = RulesPluginUI::path($this->element
->root()->name, 'add-case', $this->element
->parentElement(), $this->element
->plugin());
drupal_goto($pathAddPredicate);
}
$options['init'] = FALSE;
parent::form($form, $form_state, $options, $iterator);
}
protected function getParameterForm($name, $info, $settings, &$mode) {
$form = parent::getParameterForm($name, $info, $settings, $mode);
if ($name == 'value' && $mode == 'input') {
$labels = $this
->getValueOptionLabels();
if (isset($labels)) {
$form['settings']['value']['#type'] = 'select';
$form['settings']['value']['#options'] = $labels;
$form['settings']['value']['#empty_value'] = '';
}
}
return $form;
}
public function buildContent() {
$content = parent::buildContent();
// Use option label for text.
if (isset($this->element->settings['value'])) {
$value = $this->element->settings['value'];
$labels = $this
->getValueOptionLabels();
$content['label']['#markup'] = t('@plugin: @case', array(
'@plugin' => $this->element
->label(),
'@case' => isset($labels[$value]) ? $labels[$value] : $value,
));
unset($content['description']['parameter']['value']);
}
return $content;
}
public function getValueOptionLabels() {
$parent = $this->element
->parentElement();
if (isset($parent->settings['data:select'])) {
$dataSelector = $parent->settings['data:select'];
if ($wrapper = $this->element
->applyDataSelector($dataSelector)) {
$dataInfo = $wrapper
->info();
if (!empty($dataInfo['options list'])) {
return $wrapper
->optionsList('view');
}
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RulesConditionalCaseUI:: |
public | function |
Implements RulesPluginUIInterface. Overrides RulesContainerPluginUI:: |
|
RulesConditionalCaseUI:: |
public | function |
Generates a table for editing the contained elements. Overrides RulesContainerPluginUI:: |
|
RulesConditionalCaseUI:: |
protected | function |
Actually generates the parameter form for the given data type. Overrides RulesPluginUI:: |
|
RulesConditionalCaseUI:: |
public | function | ||
RulesConditionalPluginUI:: |
public | function |
Implements RulesPluginUIInterface. Overrides RulesContainerPluginUI:: |
1 |
RulesContainerPluginUI:: |
public | function | Gets the Add-* operations for the given element. | |
RulesContainerPluginUI:: |
public | function |
Applies the values of the form to the given rule configuration. Overrides RulesPluginUI:: |
3 |
RulesPluginUI:: |
public static | property | The base path determines where a Rules overview UI lives. | |
RulesPluginUI:: |
protected | property | ||
RulesPluginUI:: |
public static | function | Determines the default redirect target for an edited/deleted element. | |
RulesPluginUI:: |
public static | function | ||
RulesPluginUI:: |
public | function |
Implements RulesPluginUIInterface. Overrides RulesPluginUIInterface:: |
|
RulesPluginUI:: |
public | function |
Implements RulesPluginUIInterface. Overrides RulesPluginUIInterface:: |
2 |
RulesPluginUI:: |
public | function | Returns the name of class for the given data type. | |
RulesPluginUI:: |
public static | function | Returns the state values for $form, possibly only a part of the whole form. | |
RulesPluginUI:: |
public static | function | ||
RulesPluginUI:: |
public static | function | ||
RulesPluginUI:: |
public | function | Returns the form for configuring the info of a single variable. | |
RulesPluginUI:: |
public | function |
Implements RulesPluginUIInterface. Overrides RulesPluginUIInterface:: |
|
RulesPluginUI:: |
public static | function | Deprecated by the controllers overviewTable() method. | |
RulesPluginUI:: |
public static | function | Generates an operation path. | |
RulesPluginUI:: |
public | function | Adds the configuration settings form (label, tags, description, ...). | 1 |
RulesPluginUI:: |
public | function | 1 | |
RulesPluginUI:: |
protected | function | Provides a matrix permission for the component based in the existing roles. | |
RulesPluginUI:: |
public | function | ||
RulesPluginUI:: |
public | function | ||
RulesPluginUI:: |
public | function | Provide $this->element to make the code more meaningful. | 1 |