You are here

function widgets_element_definition_load in Widgets 7

Load the definition for an widget.

The element definition is a set of core properties for an widget element, not containing any user-settings. The definition defines various functions to call when configuring or executing an widget element. This loader is mostly for internal use within widget.module. Use widgets_element_load() or widgets_set_load() to get widget elements that contain configuration.

Parameters

$element: The name of the element definition to load.

$set: An widget set array to which this element will be added.

Return value

An array containing the widget element definition with the following keys:

  • "element": The unique name for the element being performed. Usually prefixed with the name of the module providing the element.
  • "module": The module providing the element.
  • "help": A description of the element.
  • "function": The name of the function that will execute the element.
  • "form": (optional) The name of a function to configure the element.
  • "summary": (optional) The name of a theme function that will display a one-line summary of the element. Does not include the "theme_" prefix.
9 calls to widgets_element_definition_load()
widgets_definition_edit_form in ./widgets.admin.inc
Form builder; Form for adding a new widget set.
widgets_definition_edit_form_validate in ./widgets.admin.inc
_state
widgets_definition_features_export in ./widgets.features.inc
Implements hook_features_export().
widgets_definition_features_export_render in ./widgets.features.inc
Implements hook_features_export_render().
widgets_elements in ./widgets.module
Load all widget elements from the database.

... See full list

File

./widgets.module, line 792
Exposes global functionality for creating widget sets.

Code

function widgets_element_definition_load($element, $set_name = NULL) {
  $definitions = widgets_element_definitions();

  // If a set is specified, do not allow loading of default set
  // elements.
  if (isset($set_name)) {
    $set = widgets_set_load($set_name, NULL);
    if ($set['storage'] == WIDGETS_STORAGE_DEFAULT) {
      return FALSE;
    }
  }
  return isset($definitions[$element]) ? $definitions[$element] : FALSE;
}