function farm_structure_type_field_allowed_values in farmOS 2.x
Allowed values callback function for the structure type field.
Return value
array Returns an array of allowed values for use in form select options.
1 string reference to 'farm_structure_type_field_allowed_values'
- Structure::buildFieldDefinitions in modules/
asset/ structure/ src/ Plugin/ Asset/ AssetType/ Structure.php
File
- modules/
asset/ structure/ farm_structure.module, line 14 - Structure asset module.
Code
function farm_structure_type_field_allowed_values() {
/** @var \Drupal\farm_structure\Entity\FarmStructureTypeInterface[] $types */
$types = \Drupal::entityTypeManager()
->getStorage('structure_type')
->loadMultiple();
$allowed_values = [];
foreach ($types as $id => $type) {
$allowed_values[$id] = $type
->getLabel();
}
return $allowed_values;
}