You are here

public function ViewsRulesLoopUI::form_validate in Views Rules 7

Implements RulesPluginUIInterface.

Overrides RulesPluginUI::form_validate

File

rules/views_rules.ui.inc, line 80
Rules UI implementation for Views Rules plugins.

Class

ViewsRulesLoopUI
Views loop administrative UI.

Code

public function form_validate($form, &$form_state) {
  parent::form_validate($form, $form_state);

  // Validate row variable names.
  $vars = $this->element
    ->availableVariables();

  /** @var $display views_rules_iterator */
  $display = $this->element
    ->getViewIterator();
  foreach ($display
    ->get_rules_variable_info() as $var_name => $var_info) {
    $name = $this->element->settings[$var_name . ':var'];
    if (isset($vars[$name])) {
      form_error($form['views_row'][$var_name]['var'], t('The variable name %name is already taken.', array(
        '%name' => $name,
      )));
    }
  }
}