You are here

public function ChangeConnectionRole::buildConfigurationForm in RedHen CRM 8

File

modules/redhen_connection/src/Plugin/Action/ChangeConnectionRole.php, line 73

Class

ChangeConnectionRole
Change the role of a Redhen Connection.

Namespace

Drupal\redhen_connection\Plugin\Action

Code

public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
  $rids = \Drupal::entityQuery('redhen_connection_role')
    ->execute();
  $role_objects = ConnectionRole::loadMultiple($rids);
  $roles = [];
  foreach ($role_objects as $rid => $role_object) {
    $roles[$rid] = $role_object
      ->label();
  }
  $form['role'] = [
    '#type' => 'radios',
    '#title' => t('Role'),
    '#options' => $roles,
    '#default_value' => '',
    '#required' => TRUE,
  ];
  return $form;
}