You are here

public function UserVariableHasRole::processSettings in Business Rules 2.x

Same name and namespace in other branches
  1. 8 src/Plugin/BusinessRulesCondition/UserVariableHasRole.php \Drupal\business_rules\Plugin\BusinessRulesCondition\UserVariableHasRole::processSettings()

Process the item settings before it's saved.

Parameters

array $settings: The settings to be processed before save the Business Rule Item.

\Drupal\business_rules\ItemInterface $item: The item being processed.

Return value

array The processed settings.

Overrides BusinessRulesItemPluginBase::processSettings

File

src/Plugin/BusinessRulesCondition/UserVariableHasRole.php, line 79

Class

UserVariableHasRole
Class UserVariableHasRole.

Namespace

Drupal\business_rules\Plugin\BusinessRulesCondition

Code

public function processSettings(array $settings, ItemInterface $item) {
  foreach ($settings['roles'] as $key => $role) {
    if ($role === 0) {
      unset($settings['roles'][$key]);
    }
  }
  return $settings;
}