You are here

function panels_edit_layout in Panels 7.3

Same name and namespace in other branches
  1. 8.3 panels.module \panels_edit_layout()
  2. 5.2 panels.module \panels_edit_layout()
  3. 6.3 panels.module \panels_edit_layout()
  4. 6.2 panels.module \panels_edit_layout()

API entry point for selecting a layout for a given display.

Layout selection is nothing more than a list of radio items encompassing the available layouts for this display, as defined by .inc files in the panels/layouts subdirectory. The only real complexity occurs when a user attempts to change the layout of a display that has some content in it.

Parameters

object $display: A fully loaded panels $display object, as returned from panels_load_display(). Merely passing a did is NOT sufficient.

string $finish: A string that will be used for the text of the form submission button. If no value is provided, then the form submission button will default to t('Save').

mixed $destination: Basic usage is a string containing the URL that the form should redirect to upon submission. For a discussion of advanced usages, see panels_edit().

mixed $allowed_layouts: Allowed layouts has three different behaviors that depend on which of three value types are passed in by the caller: #- if $allowed_layouts instanceof panels_allowed_layouts (includes subclasses): the most complex use of the API. The caller is passing in a loaded panels_allowed_layouts object that the client module previously created and stored somewhere using a custom storage mechanism. #- if is_string($allowed_layouts): the string will be used in a call to variable_get() which will call the $allowed_layouts . '_allowed_layouts' var. If the data was stored properly in the system var, the $allowed_layouts object will be unserialized and recreated. #- if is_null($allowed_layouts): the default behavior, which also provides backwards compatibility for implementations of the Panels2 API written before beta4. In this case, a dummy panels_allowed_layouts object is created which does not restrict any layouts. Subsequent behavior is indistinguishable from pre-beta4 behavior.

Return value

mixed Can return nothing, or a modified $display object, or a redirection string; return values for the panels_edit* family of functions are quite complex. See panels_edit() for detailed discussion.

See also

panels_edit()

panels_common_set_allowed_layouts()

1 call to panels_edit_layout()
panels_node_edit_layout in panels_node/panels_node.module
Pass through to the panels layout editor.

File

./panels.module, line 756
Core functionality for the Panels engine.

Code

function panels_edit_layout($display, $finish, $destination = NULL, $allowed_layouts = NULL) {
  ctools_include('display-layout', 'panels');
  ctools_include('plugins', 'panels');
  return _panels_edit_layout($display, $finish, $destination, $allowed_layouts);
}