function xbbcode_custom_tag_load in Extensible BBCode 8.2
Same name and namespace in other branches
- 8 xbbcode.crud.inc \xbbcode_custom_tag_load()
- 7 xbbcode.crud.inc \xbbcode_custom_tag_load()
Load a custom tag.
Parameters
$name: (optional) if passed, return the custom tag with this name. Otherwise, return all.
Return value
Either a data object, or an array of objects indexed by name.
2 calls to xbbcode_custom_tag_load()
- XBBCodeTagForm::buildForm in src/
Form/ XBBCodeTagForm.php - xbbcode_xbbcode_info in ./
xbbcode.module - Implements hook_xbbcode_info().
2 string references to 'xbbcode_custom_tag_load'
- XBBCodeTagForm::_submitFormDelete in src/
Form/ XBBCodeTagForm.php - Delete selected custom tags.
- XBBCodeTagForm::_submitFormSave in src/
Form/ XBBCodeTagForm.php - Save (create or update) a custom tag.
File
- ./
xbbcode.crud.inc, line 32 - Data interface for creating, reading, updating and deleting records.
Code
function xbbcode_custom_tag_load($name = NULL) {
$tags =& drupal_static(__FUNCTION__, array());
if (empty($tags)) {
$rows = db_select('xbbcode_custom_tag', 'tag')
->fields('tag')
->execute()
->fetchAll();
foreach ($rows as $row) {
$row->options = unserialize($row->options);
$tags[$row->name] = $row;
}
}
if ($name) {
return isset($tags[$name]) ? $tags[$name] : NULL;
}
else {
return $tags;
}
}