You are here

public function RemoveUserRole::getVariables in Business Rules 2.x

Same name and namespace in other branches
  1. 8 src/Plugin/BusinessRulesAction/RemoveUserRole.php \Drupal\business_rules\Plugin\BusinessRulesAction\RemoveUserRole::getVariables()

Return a variable set with all used variables on the item.

If you are using variables in a textfield, you can use the regex as the following:

preg_match_all(BusinessRulesItemPluginInterface::VARIABLE_REGEX, $text, $variables);

The $variables array will be filled with all used variables at index [1]

Parameters

\Drupal\business_rules\ItemInterface $item: The business rule item.

Return value

\Drupal\business_rules\VariablesSet The variableSet with all variables used on the Item.

Overrides BusinessRulesItemPluginBase::getVariables

File

src/Plugin/BusinessRulesAction/RemoveUserRole.php, line 82

Class

RemoveUserRole
Class RemoveUserRole.

Namespace

Drupal\business_rules\Plugin\BusinessRulesAction

Code

public function getVariables(ItemInterface $item) {
  $variableSet = parent::getVariables($item);
  if ($item
    ->getSettings('user_container') == 'variable') {
    $variableObj = new VariableObject($item
      ->getSettings('variable'), NULL, $item
      ->getType());
    $variableSet
      ->append($variableObj);
  }
  return $variableSet;
}