function xbbcode_handlers_load in Extensible BBCode 8
Same name and namespace in other branches
- 7 xbbcode.crud.inc \xbbcode_handlers_load()
Load all handlers for a specific format.
Parameters
$format_id: Optional text format ID.
$disabled: Whether to load disabled handlers as well. Defaults to false.
Return value
A numerically indexed array of handler objects.
3 calls to xbbcode_handlers_load()
- xbbcode_rebuild_handlers in ./
xbbcode.module - xbbcode_settings_handlers_format in ./
xbbcode.admin.inc - Modify handler settings (subform).
- _xbbcode_build_tags in ./
xbbcode.inc - Invoke all handlers to get the tags for a certain format.
File
- ./
xbbcode.crud.inc, line 106 - Data interface for creating, reading, updating and deleting records.
Code
function xbbcode_handlers_load($format_id = XBBCODE_GLOBAL, $disabled = FALSE) {
if ($format_id != XBBCODE_GLOBAL && !in_array($format_id, xbbcode_formats('specific'))) {
$format_id = XBBCODE_GLOBAL;
}
$cache =& drupal_static(__FUNCTION__, array());
if (!isset($cache[$format_id]) || $disabled) {
$query = db_select('xbbcode_handler', 'handler')
->fields('handler')
->condition('format', $format_id);
if (!$disabled) {
$query
->condition('enabled', 1);
}
$all = $query
->execute()
->fetchAll();
$handlers = array();
foreach ($all as $handler) {
$handlers[$handler->name] = $handler;
}
if ($disabled) {
return $handlers;
}
$cache[$format_id] = $handlers;
}
return $cache[$format_id];
}