protected function SocialAlbumOptionsSelectWidget::getOptions in Open Social 10.3.x
Same name and namespace in other branches
- 10.0.x modules/social_features/social_album/src/Plugin/Field/FieldWidget/SocialAlbumOptionsSelectWidget.php \Drupal\social_album\Plugin\Field\FieldWidget\SocialAlbumOptionsSelectWidget::getOptions()
- 10.1.x modules/social_features/social_album/src/Plugin/Field/FieldWidget/SocialAlbumOptionsSelectWidget.php \Drupal\social_album\Plugin\Field\FieldWidget\SocialAlbumOptionsSelectWidget::getOptions()
- 10.2.x modules/social_features/social_album/src/Plugin/Field/FieldWidget/SocialAlbumOptionsSelectWidget.php \Drupal\social_album\Plugin\Field\FieldWidget\SocialAlbumOptionsSelectWidget::getOptions()
Returns the array of options for the widget.
Parameters
\Drupal\Core\Entity\FieldableEntityInterface $entity: The entity for which to return options.
Return value
array The array of options for the widget.
Overrides OptionsWidgetBase::getOptions
File
- modules/
social_features/ social_album/ src/ Plugin/ Field/ FieldWidget/ SocialAlbumOptionsSelectWidget.php, line 46
Class
- SocialAlbumOptionsSelectWidget
- Plugin implementation of the 'social_album_options_select' widget.
Namespace
Drupal\social_album\Plugin\Field\FieldWidgetCode
protected function getOptions(FieldableEntityInterface $entity) {
$options = parent::getOptions($entity);
$option = $options['_none'];
unset($options['_none']);
// @todo FIX issues with options, if user selects an option
// we need to update the Post visibility accordingly with ajax.
// imagine a user on the home stream, selecting an existing album in a
// close group, the visibility needs to be updated to Group members, which
// it doesn't, so for now we're not rendering any other option.
// Return [...] + $options.
return [
'_none' => $option,
'_add' => $this
->t('Create new album'),
];
}