Returns the available paragraphs type.
array Available paragraphs types.
protected function getAccessibleOptions() {
if ($this->accessOptions !== NULL) {
return $this->accessOptions;
}
$entity_type_manager = \Drupal::entityTypeManager();
$target_type = $this
->getFieldSetting('target_type');
$bundles = $this
->getAllowedTypes();
$access_control_handler = $entity_type_manager
->getAccessControlHandler($target_type);
$dragdrop_settings = $this
->getSelectionHandlerSetting('target_bundles_drag_drop');
$this->accessOptions = [];
foreach ($bundles as $machine_name => $bundle) {
if ($dragdrop_settings || (empty($this
->getSelectionHandlerSetting('target_bundles')) || in_array($machine_name, $this
->getSelectionHandlerSetting('target_bundles')))) {
if ($access_control_handler
->createAccess($machine_name)) {
$this->accessOptions[$machine_name] = $bundle['label'];
}
}
}
return $this->accessOptions;
}