function _blockreference_potential_references in Block reference 7
Same name and namespace in other branches
- 6 blockreference.module \_blockreference_potential_references()
Fetch an array of all candidate referenced blocks.
Parameters
$field: Array containing field data.
$current_bids: Array of current bids.
$return_full_blocks: Whether to return full blocks.
$string: Filter string to match blocks.
$exact_string: Strictly match string like for validation.
Return value
An array of whatever is needed.
5 calls to _blockreference_potential_references()
- blockreference_autocomplete in ./
blockreference.module - Menu callback for the autocomplete results.
- blockreference_autocomplete_validate in ./
blockreference.module - Validation callback for a blockreference autocomplete element.
- blockreference_field_validate in ./
blockreference.module - Implements hook_field_validate().
- blockreference_list_values in ./
blockreference.module - Build the select options for a blockreference_select_sort element.
- blockreference_options_list in ./
blockreference.module - Implements hook_options_list().
File
- ./
blockreference.module, line 499 - Defines a field type for referencing a block from a node.
Code
function _blockreference_potential_references($field, $current_bids = array(), $return_full_blocks = FALSE, $string = '', $exact_string = FALSE) {
$results =& drupal_static(__FUNCTION__, array());
// Create unique id for static cache.
$cid = $field['field_name'] . ':' . (int) $return_full_blocks . ':' . $string . ':' . (int) $exact_string;
if (!isset($results[$cid])) {
$references = _blockreference_potential_references_standard($field, $current_bids, $return_full_blocks, $string, $exact_string);
// Incorrect legacy alter.
drupal_alter('blockreference_potential_references', $references, $field, $current_bids, $return_full_blocks, $string, $exact_string);
// Correct new alter.
$context = compact('field', 'current_bids', 'return_full_blocks', 'string', 'exact_string');
drupal_alter('blockreference_potential_references2', $references, $context);
// Store the results.
$results[$cid] = !empty($references) ? $references : array();
}
return $results[$cid];
}