protected function ParameterEditForm::buildParameterTypeOptions in Page Manager 8.4
Same name and namespace in other branches
- 8 page_manager_ui/src/Form/ParameterEditForm.php \Drupal\page_manager_ui\Form\ParameterEditForm::buildParameterTypeOptions()
Builds an array of options for the parameter type.
Return value
array[] A multidimensional array. The top level is keyed by group ('Content', 'Configuration', 'Typed Data'). Those values are an array of type labels, keyed by the machine name.
1 call to ParameterEditForm::buildParameterTypeOptions()
- ParameterEditForm::buildForm in page_manager_ui/
src/ Form/ ParameterEditForm.php - Form constructor.
File
- page_manager_ui/
src/ Form/ ParameterEditForm.php, line 173
Class
- ParameterEditForm
- Provides a form for editing a parameter.
Namespace
Drupal\page_manager_ui\FormCode
protected function buildParameterTypeOptions() {
$options = [
static::NO_CONTEXT_KEY => $this
->t('No context selected'),
];
// Make a grouped, sorted list of entity type options. Key the inner array
// to use the typed data format of 'entity:$entity_type_id'.
foreach ($this->entityTypeRepository
->getEntityTypeLabels(TRUE) as $group_label => $grouped_options) {
foreach ($grouped_options as $key => $label) {
$options[$group_label]['entity:' . $key] = $label;
}
}
$primitives_label = (string) $this
->t('Primitives');
foreach ($this->typedDataManager
->getDefinitions() as $key => $definition) {
if (is_subclass_of($definition['class'], PrimitiveInterface::class)) {
$options[$primitives_label][$key] = $definition['label'];
}
}
asort($options[$primitives_label], SORT_NATURAL);
return $options;
}