You are here

function fullcalendar_legend_build_legend in FullCalendar 7.2

Builds the legend as a render array.

Parameters

object $view: The View object.

string $type: The type of legend to build, either 'bundle' or 'taxonomy'.

Return value

array The render array representing the legend.

2 calls to fullcalendar_legend_build_legend()
fullcalendar_legend_block_view in fullcalendar_legend/fullcalendar_legend.module
Implements hook_block_view().
fullcalendar_legend_content_type_render in fullcalendar_legend/plugins/content_types/fullcalendar_legend.inc
Implements MODULE_PLUGIN_content_type_render().

File

fullcalendar_legend/fullcalendar_legend.module, line 98
Adds a legend of event types.

Code

function fullcalendar_legend_build_legend($view, $type) {

  // Restrict the fields to only date fields used by the view.
  $fields = array();
  foreach ($view->display_handler
    ->get_handlers('field') as $field) {
    if (fullcalendar_field_is_date($field)) {
      $fields[$field->field_info['field_name']] = $field->field_info;
    }
  }
  $function = "fullcalendar_legend_get_type_{$type}";
  $element = array(
    '#theme' => 'fullcalendar_legend',
    '#types' => $function($fields),
  );
  return $element;
}