You are here

public function RulesContainerPluginUI::buildContent in Rules 7.2

Implements RulesPluginUIInterface.

Shows a preview of the configuration settings.

Overrides RulesPluginUI::buildContent

1 call to RulesContainerPluginUI::buildContent()
RulesLoopUI::buildContent in ui/ui.plugins.inc
Implements RulesPluginUIInterface.
1 method overrides RulesContainerPluginUI::buildContent()
RulesLoopUI::buildContent in ui/ui.plugins.inc
Implements RulesPluginUIInterface.

File

ui/ui.core.inc, line 1110
Contains core Rules UI functions.

Class

RulesContainerPluginUI
UI for Rules Container.

Code

public function buildContent() {
  $content = parent::buildContent();

  // Don't link the title for embedded container plugins, except for rules.
  if (!$this->element
    ->isRoot() && !$this->element instanceof Rule) {

    // $content['label']['#type'] is currently set to 'link', but in this
    // case we don't want a link, we just want 'markup' text.
    $content['label']['#type'] = 'markup';
    $content['label']['#markup'] = check_plain($content['label']['#title']);
    unset($content['label']['#title']);
  }
  elseif ($this->element
    ->isRoot()) {
    $content['description']['settings'] = array(
      '#theme' => 'rules_content_group',
      '#weight' => -4,
      'machine_name' => array(
        '#markup' => t('Machine name') . ': ' . $this->element->name,
      ),
      'weight' => array(
        '#access' => $this->element instanceof RulesTriggerableInterface,
        '#markup' => t('Weight') . ': ' . $this->element->weight,
      ),
    );
    if (!empty($this->element->tags)) {
      $content['description']['tags'] = array(
        '#theme' => 'rules_content_group',
        '#caption' => t('Tags'),
        'tags' => array(
          '#markup' => implode(', ', array_map(function ($entry) {
            return l($entry, '/admin/config/workflow/rules', array(
              'query' => array(
                'event' => '0',
                'tag' => $entry,
              ),
            ));
          }, $this->element->tags)),
        ),
      );
    }
    if ($vars = $this->element
      ->componentVariables()) {
      $content['description']['variables'] = array(
        '#caption' => t('Parameter'),
        '#theme' => 'rules_content_group',
      );
      foreach ($vars as $name => $info) {
        if (!isset($info['parameter']) || $info['parameter']) {
          $content['description']['variables'][$name] = array(
            '#theme' => 'rules_variable_view',
            '#info' => $info,
            '#name' => $name,
          );
        }
      }
    }
  }
  return $content;
}