You are here

function views_rules_plugin_display_rules::variables_option_form in Views Rules 7

Builds row variables option form.

1 call to views_rules_plugin_display_rules::variables_option_form()
views_rules_plugin_display_rules::options_form in views/views_rules_plugin_display_rules.inc
Builds display options.

File

views/views_rules_plugin_display_rules.inc, line 181
Configures views for use within Rules.

Class

views_rules_plugin_display_rules
Rules display plugin.

Code

function variables_option_form(&$form, &$form_state) {
  $form['#title'] = t('Rules: row variables');

  // Add configuration for fields.
  if ($this
    ->uses_fields()) {
    $form['help'] = array(
      '#prefix' => '<p>',
      '#markup' => t('Configure the variable info for each field as they would be used in Rules.'),
      '#suffix' => '</p>',
    );

    // Build variable forms.
    $option_variables = (array) $this
      ->get_option('rules_variables');
    foreach ($this
      ->get_field_labels() as $variable => $label) {
      $option_variables += array(
        $variable => array(),
      );
      $form[$variable] = $this
        ->get_variable_form($variable, $label, $option_variables[$variable], TRUE);
    }
  }
  elseif ($entity_info = entity_get_info($entity_type = $this->view->base_table)) {
    $form['notice'] = array(
      '#markup' => '<p>' . t('The row style does not use fields. The loop item variable will be the entity variable.') . '</p>',
    );
    $form['variable'] = array(
      '#prefix' => '<p>' . t('Variable details:') . '</p>',
      '#markup' => '<dl>' . '<dt>' . t('Type') . '</dt>' . '<dd>' . $entity_info['label'] . '</dd>' . '<dt>' . t('Label') . '</dt>' . '<dd>' . $entity_info['label'] . '</dd>' . '<dt>' . t('Name') . '</dt>' . '<dd>' . $entity_type . '</dd>' . '</dl>',
    );
  }
}