You are here

function panels_common_get_allowed_layouts in Panels 6.3

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

Get the allowed layouts for the given module.

2 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

File

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

Code

function panels_common_get_allowed_layouts($module_name) {
  $available_layouts = panels_get_layouts();
  if (empty($module_name)) {
    return $available_layouts;
  }
  else {
    if (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;
}