private function BlazyAdminFormatterBase::getFieldOptionsInternal in Blazy 7
Helper function to get list of supported field base on field_types.
1 call to BlazyAdminFormatterBase::getFieldOptionsInternal()
- BlazyAdminFormatterBase::getFieldOptions in src/
Form/ BlazyAdminFormatterBase.php - Returns available fields for select options.
File
- src/
Form/ BlazyAdminFormatterBase.php, line 246
Class
- BlazyAdminFormatterBase
- A base for field formatter admin to have re-usable methods in one place.
Namespace
Drupal\blazy\FormCode
private function getFieldOptionsInternal($allowed_bundles, $target_type, $field_types) {
$options = [];
foreach ($allowed_bundles as $bundle_name => $bundle) {
if ($bundle !== -1) {
$fields = field_info_instances($target_type, $bundle_name);
foreach ($fields as $name => $field) {
if (in_array($name, $this
->getExcludedFieldOptions())) {
continue;
}
$info = field_info_field($name);
if (empty($field_types)) {
$options[$name] = $field['label'];
}
else {
if (in_array($target_type, array_keys($info['bundles'])) && in_array($info['type'], $field_types)) {
$options[$name] = $field['label'];
}
}
}
}
}
return $options;
}