protected function Bundle::buildLegend in FullCalendar 8
Same name and namespace in other branches
- 8.5 modules/fullcalendar_legend/src/Plugin/block/Bundle.php \Drupal\fullcalendar_legend\Plugin\Block\Bundle::buildLegend()
- 8.2 modules/fullcalendar_legend/src/Plugin/block/Bundle.php \Drupal\fullcalendar_legend\Plugin\Block\Bundle::buildLegend()
- 8.3 fullcalendar_legend/src/Plugin/block/Bundle.php \Drupal\fullcalendar_legend\Plugin\Block\Bundle::buildLegend()
- 8.4 modules/fullcalendar_legend/src/Plugin/block/Bundle.php \Drupal\fullcalendar_legend\Plugin\Block\Bundle::buildLegend()
Parameters
\Drupal\Core\Field\FieldDefinitionInterface[] $fields:
Return value
array
Overrides FullcalendarLegendBase::buildLegend
File
- fullcalendar_legend/
src/ Plugin/ block/ Bundle.php, line 27 - Contains \Drupal\fullcalendar_legend\Plugin\Block\Bundle.
Class
- Bundle
- TODO
Namespace
Drupal\fullcalendar_legend\Plugin\BlockCode
protected function buildLegend(array $fields) {
$types = [];
$bundle_info = \Drupal::service('entity_type.bundle.info')
->getAllBundleInfo();
foreach ($fields as $field_name => $field) {
$entity_type = $field
->getTargetEntityTypeId();
foreach ($field
->getBundles() as $bundle) {
if (!isset($types[$bundle])) {
$types[$bundle]['entity_type'] = $entity_type;
$types[$bundle]['field_name'] = $field_name;
$types[$bundle]['bundle'] = $bundle;
$types[$bundle]['label'] = $bundle_info[$entity_type][$bundle]['label'];
}
}
}
return $types;
}