You are here

function fieldable_panels_pane_type_load in Fieldable Panels Panes (FPP) 7

Properly format the type from the URL version to the internal version.

1 call to fieldable_panels_pane_type_load()
fieldable_panels_panes_type_load in ./fieldable_panels_panes.module
@depricated Backwards compatability layer.

File

./fieldable_panels_panes.module, line 610
Maintains an entity that appears as panel pane content.

Code

function fieldable_panels_pane_type_load($type) {

  // If the type is not set or equals 'view', return FALSE. This appears to be
  // caused by incorrect menu item ordering, but it is still unclear why it
  // happens.
  // @todo Work out the root cause of this happening.
  if (empty($type) || $type == 'view') {
    return FALSE;
  }
  $type = str_replace('-', '_', $type);
  $entity_info = entity_get_info('fieldable_panels_pane');
  if (isset($entity_info['bundles'][$type])) {
    return $type;
  }
  else {

    // Special handling for two legacy paths:
    // * admin/structure/fieldable-panels-panes/manage/FPPTYPE/fields
    // * admin/structure/fieldable-panels-panes/manage/FPPTYPE/display
    // Redirect these paths as appropriate. Need to be extra verbose here to
    // avoid breaking other paths.
    if ($type == 'manage' && arg(0) == 'admin' && arg(1) == 'structure' && arg(2) == 'fieldable-panels-panes' && (arg(5) == 'fields' || arg(5) == 'display')) {
      drupal_goto('admin/structure/fieldable-panels-panes/' . arg(4) . '/' . arg(5));
    }
    else {

      // If nothing else, return false.
      return FALSE;
    }
  }
}