You are here

public function ViewResultVariable::changeDetails in Business Rules 2.x

Same name and namespace in other branches
  1. 8 src/Plugin/BusinessRulesVariable/ViewResultVariable.php \Drupal\business_rules\Plugin\BusinessRulesVariable\ViewResultVariable::changeDetails()

Change the variable details box.

Give a chance to each variable plugin to change the variable details row on Available Variables Box.

Parameters

\Drupal\business_rules\Entity\Variable $variable: The variable.

array $row: The row which contains the variable.

Overrides BusinessRulesVariablePlugin::changeDetails

File

src/Plugin/BusinessRulesVariable/ViewResultVariable.php, line 91

Class

ViewResultVariable
Class ViewResultVariable.

Namespace

Drupal\business_rules\Plugin\BusinessRulesVariable

Code

public function changeDetails(Variable $variable, array &$row) {

  // Show a link to a modal window which all fields from the view.
  $content = $this
    ->variableFields($variable);
  $keyvalue = $this->util
    ->getKeyValueExpirable('view_result_variable');
  $keyvalue
    ->set('variableFields.' . $variable
    ->id(), $content);
  $details_link = Link::createFromRoute(t('Click here to see the view fields'), 'business_rules.ajax.modal', [
    'method' => 'nojs',
    'title' => t('View fields'),
    'collection' => 'view_result_variable',
    'key' => 'variableFields.' . $variable
      ->id(),
  ], [
    'attributes' => [
      'class' => [
        'use-ajax',
      ],
    ],
  ])
    ->toString();
  $row['description']['data']['#markup'] .= '<br>' . $details_link;
}