You are here

public function RolesConditionCreator::createConditionConfig in Block Visibility Groups 8

Create condition configuration from form submission.

Parameters

array $plugin_info: The plugin implementation definition.

Return value

array The condition config.

Overrides ConditionCreatorBase::createConditionConfig

File

block_visibility_groups_admin/src/Plugin/ConditionCreator/RolesConditionCreator.php, line 53

Class

RolesConditionCreator
A condition creator to be used in creating user role condition.

Namespace

Drupal\block_visibility_groups_admin\Plugin\ConditionCreator

Code

public function createConditionConfig($plugin_info) {
  $config = parent::createConditionConfig($plugin_info);
  $config['roles'] = array_filter($config['roles']);

  // @todo Dynamically figure out context by loading connect plugin?
  $config['context_mapping'] = [
    'user' => '@user.current_user_context:current_user',
  ];
  return $config;
}