You are here

function finder_element in Finder 7

Same name and namespace in other branches
  1. 6 finder.module \finder_element()

Get an element from a finder.

Finder stores it's elements in an indexed array, as well as tracking an array that maps finder element IDs to the index position. This can be awkward to use when dealing with a particular element's settings especially when the element variable needs to be a reference to an element in the finder variable. This function conveniently allows us to pull a finder element into a reference. If called by reference, for example, $element = &finder_element($finder, $finder_element_id); this function will return a reference to a finder element from the supplied finder as identified by the supplied finder element id, if not called by reference it will return a copy of the element.

Parameters

&$finder: The finder object from which to get the element.

&$finder_element_id: The ID of the finder element required.

Return value

The finder element, or reference to the finder element.

10 calls to finder_element()
finder_admin_element_delete in includes/finder.admin.inc
Admin finder delete page
finder_admin_element_edit in includes/finder.admin.inc
Admin finder element add/edit page. Must have a Finder object at this point.
finder_autocomplete_autocomplete in modules/finder_autocomplete/finder_autocomplete.module
Menu callback; get autocomplete suggestions.
finder_find_choices in ./finder.module
Postprocessing for returned finder_find options when mode is choices.
finder_find_query in ./finder.module
Build basic finder query arrays.

... See full list

3 string references to 'finder_element'
finder_element_load_multiple in ./finder.module
Load finder element objects from the database.
finder_element_save in ./finder.module
Save changes to a finder element or add a new finder element.
finder_load_objects in ./finder.module
Load objects from the database.

File

./finder.module, line 1394
The finder module.

Code

function &finder_element(&$finder, &$finder_element_id) {
  $key =& $finder->elements_index[$finder_element_id];
  return $finder->elements[$key];
}