You are here

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

Same name and namespace in other branches
  1. 8 src/Plugin/BusinessRulesVariable/EntityEmptyVariable.php \Drupal\business_rules\Plugin\BusinessRulesVariable\EntityEmptyVariable::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/EntityEmptyVariable.php, line 68

Class

EntityEmptyVariable
Class EntityEmptyVariable.

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 Entity Variable.
  $content = $this->util
    ->getVariableFieldsModalInfo($variable);
  $keyvalue = $this->util
    ->getKeyValueExpirable('entity_empty_variable');
  $keyvalue
    ->set('variableFields.' . $variable
    ->id(), $content);
  $details_link = Link::createFromRoute(t('Click here to see the entity fields'), 'business_rules.ajax.modal', [
    'method' => 'nojs',
    'title' => t('Entity fields'),
    'collection' => 'entity_empty_variable',
    'key' => 'variableFields.' . $variable
      ->id(),
  ], [
    'attributes' => [
      'class' => [
        'use-ajax',
      ],
    ],
  ])
    ->toString();
  $row['description']['data']['#markup'] .= '<br>' . $details_link;
}