Bundle.php in FullCalendar 8.2
File
modules/fullcalendar_legend/src/Plugin/block/Bundle.php
View source
<?php
namespace Drupal\fullcalendar_legend\Plugin\Block;
use Drupal\Core\Link;
use Drupal\field_ui\FieldUI;
class Bundle extends FullcalendarLegendBase {
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;
}
}