You are here

function xbbcode_handler_save in Extensible BBCode 8

Same name and namespace in other branches
  1. 7 xbbcode.crud.inc \xbbcode_handler_save()

Create or change a handler, assigning it to a new module.

Parameters

$handler: A full handler object with a module, enabled, name and weight property.

$format: An optional text format ID.

2 calls to xbbcode_handler_save()
xbbcode_rebuild_handlers in ./xbbcode.module
xbbcode_settings_handlers_save_submit in ./xbbcode.admin.inc
Save the handler settings.

File

./xbbcode.crud.inc, line 139
Data interface for creating, reading, updating and deleting records.

Code

function xbbcode_handler_save($handler, $format = XBBCODE_GLOBAL) {
  $query = db_merge('xbbcode_handler')
    ->fields(array(
    'module' => "{$handler->module}",
    'enabled' => (int) $handler->enabled,
    'format' => $format,
  ))
    ->key(array(
    'name' => "{$handler->name}",
  ))
    ->execute();
  return $query;
}