You are here

function fieldable_panels_panes_fieldable_panels_pane_content_type_render in Fieldable Panels Panes (FPP) 7

Callback to render our content type.

Note: don't add the 'array' type hint for $panel_args or $context as they might be NULL.

1 call to fieldable_panels_panes_fieldable_panels_pane_content_type_render()
fieldable_panels_panes_fieldable_panels_pane_content_type_admin_info in plugins/content_types/fieldable_panels_pane.inc
Callback to provide administrative information for a fieldable panels pane.

File

plugins/content_types/fieldable_panels_pane.inc, line 171
CTools content type to render a fielded panel pane.

Code

function fieldable_panels_panes_fieldable_panels_pane_content_type_render($subtype, $conf, $panel_args = array(), $context = array()) {
  $entity = fieldable_panels_panes_load_from_subtype($subtype);
  if (!empty($entity) && !empty($entity->fpid) && fieldable_panels_panes_access('view', $entity)) {
    $view_mode = isset($conf['view_mode']) ? $conf['view_mode'] : 'full';
    $settings = field_bundle_settings('fieldable_panels_pane', $entity->bundle);

    // Add pane config to the entity object before hook_view().
    $entity->conf = $conf;
    $block = new stdClass();
    $block->title = '';
    $block->content = fieldable_panels_panes_view($entity, $view_mode);

    // Was there a title defined?
    if (!empty($entity->title)) {

      // Is this view mode configured?
      $is_view_mode_set = isset($settings['extra_fields']['display']['title'][$view_mode]['visible']);

      // Should the default view mode show the title?
      $show_default_title = !empty($settings['extra_fields']['display']['title']['default']['visible']);

      // Is the title configured for this view mode?
      $show_view_mode_title = $is_view_mode_set && $settings['extra_fields']['display']['title'][$view_mode]['visible'];

      // Combine all of the above logic.
      if (empty($settings['extra_fields']['display']) || !$is_view_mode_set && $show_default_title || $show_view_mode_title) {
        $block->title = filter_xss_admin($entity->title);
      }
    }
    return $block;
  }
}