You are here

function panels_common_get_allowed_layouts in Panels 7.3

Same name and namespace in other branches
  1. 6.3 includes/common.inc \panels_common_get_allowed_layouts()

Get the allowed layouts for the given module.

4 calls to panels_common_get_allowed_layouts()
panels_choose_layout in includes/display-layout.inc
Form definition for the display layout editor.
panels_node_add in panels_node/panels_node.module
Override of node add page to force layout selection prior to actually editing a node.
panels_node_panels_cache_get in panels_node/panels_node.module
Get display edit cache for a panel node being edited.
panels_renderer_ipe::ajax_change_layout in panels_ipe/plugins/display_renderers/panels_renderer_ipe.class.php
AJAX entry point to create the controller form for an IPE.

File

includes/common.inc, line 489
Functions used by more than one panels client module.

Code

function panels_common_get_allowed_layouts($module_name) {
  ctools_include('plugins', 'panels');
  $available_layouts = panels_get_layouts();
  if (empty($module_name)) {
    return $available_layouts;
  }
  elseif (is_object($module_name)) {
    $allowed_layouts = $module_name;
  }
  else {
    $allowed_layouts = panels_common_get_allowed_layout_object($module_name);
  }
  $allowed = array_filter($allowed_layouts->allowed_layout_settings);
  $order = array();
  foreach ($available_layouts as $name => $plugin) {
    if (!empty($allowed[$name])) {
      $order[$name] = $plugin['category'] . ':' . $plugin['title'];
    }
  }

  // Sort.
  $layouts = array();
  asort($order);
  foreach ($order as $name => $junk) {
    $layouts[$name] = $available_layouts[$name];
  }
  return $layouts;
}