You are here

function fieldable_panels_panes_fieldable_panels_pane_content_type in Fieldable Panels Panes (FPP) 7

Return an individual FPP.

1 string reference to 'fieldable_panels_panes_fieldable_panels_pane_content_type'
fieldable_panels_panes_fieldable_panels_pane_ctools_content_types in plugins/content_types/fieldable_panels_pane.inc
Small hook implementation of plugin.

File

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

Code

function fieldable_panels_panes_fieldable_panels_pane_content_type($subtype_id, $plugin) {
  $content_type = array();

  // If an ID was passed in, try loading a corresponding FPP.
  if (strpos($subtype_id, ':') !== FALSE) {

    // If a specific FPP was requested, load it. Use the 'force' method to
    // avoid inadvertently triggering an infinite loop.
    $entity = fieldable_panels_panes_load_from_subtype_force($subtype_id);

    // The FPP could be loaded, so generate its content type definition.
    if (!empty($entity)) {
      $content_type = _fieldable_panels_panes_custom_content_type($entity);
    }
    else {
      return $content_type;
    }
  }

  // If nothing was loaded yet.
  if (empty($content_type)) {
    $type = 'fieldable_panels_pane';
    $subtypes = ctools_content_get_subtypes($type);
    if (isset($subtypes[$subtype_id])) {
      $content_type = $subtypes[$subtype_id];
    }

    // If there's only 1 and we somehow have the wrong subtype ID, do not
    // care. Return the proper subtype anyway.
    if (empty($content_type) && !empty($plugin['single'])) {
      $content_type = current($subtypes);
    }
  }

  // Trigger hook_fieldable_panels_pane_content_type_alter().
  drupal_alter('fieldable_panels_pane_content_type', $content_type, $subtype_id, $plugin);
  return $content_type;
}