You are here

protected function GroupBaseForm::getGroupOptions in Entity Share 8

Same name and namespace in other branches
  1. 8.3 modules/entity_share_server/src/Form/GroupBaseForm.php \Drupal\entity_share_server\Form\GroupBaseForm::getGroupOptions()
  2. 8.2 modules/entity_share_server/src/Form/GroupBaseForm.php \Drupal\entity_share_server\Form\GroupBaseForm::getGroupOptions()

Helper function to get the conjunction options.

Parameters

string $group_id: A group id to exclude. To avoid putting a group into itself.

Return value

array An array of options.

2 calls to GroupBaseForm::getGroupOptions()
GroupAddForm::form in modules/entity_share_server/src/Form/GroupAddForm.php
Gets the actual form array to be built.
GroupEditForm::form in modules/entity_share_server/src/Form/GroupEditForm.php
Gets the actual form array to be built.

File

modules/entity_share_server/src/Form/GroupBaseForm.php, line 46

Class

GroupBaseForm
Class GroupBaseForm.

Namespace

Drupal\entity_share_server\Form

Code

protected function getGroupOptions($group_id = '') {

  /** @var \Drupal\entity_share_server\Entity\ChannelInterface $channel */
  $channel = $this->entity;
  $channel_groups = $channel
    ->get('channel_groups');
  if (is_null($channel_groups)) {
    $channel_groups = [];
  }
  $member_options = array_keys($channel_groups);
  $options = array_combine($member_options, $member_options);
  if (isset($options[$group_id])) {
    unset($options[$group_id]);
  }
  return $options;
}