You are here

function xbbcode_schema in Extensible BBCode 6

Same name and namespace in other branches
  1. 8 xbbcode.install \xbbcode_schema()
  2. 8.2 xbbcode.install \xbbcode_schema()
  3. 7 xbbcode.install \xbbcode_schema()

File

./xbbcode.install, line 9

Code

function xbbcode_schema() {
  $schema['xbbcode_custom_tags'] = array(
    'description' => 'Custom tags created manually',
    'fields' => array(
      // Key
      'name' => array(
        'description' => 'Identifies the tag, and serves also to recognize it in text',
        'type' => 'varchar',
        'not null' => TRUE,
        'length' => 32,
      ),
      // Data
      'replacewith' => array(
        'description' => 'The code that this tag should be replaced with when filtering',
        'type' => 'text',
        'size' => 'normal',
        'not null' => TRUE,
      ),
      'description' => array(
        'description' => 'Describes the use of this tag for the help text',
        'type' => 'text',
        'size' => 'normal',
        'not null' => TRUE,
      ),
      'sample' => array(
        'description' => 'A sample of how this tag is to be used',
        'type' => 'text',
        'size' => 'normal',
        'not null' => TRUE,
      ),
      // Options
      'dynamic' => array(
        'description' => 'Whether this code should be evaluated as PHP rather than HTML',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'selfclosing' => array(
        'description' => 'Whether the tag requires a closing tag or not',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'multiarg' => array(
        'description' => 'Whether the tag accepts multiple named attributes rather than a single option string',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'name',
    ),
  );
  $schema['xbbcode_handlers'] = array(
    'description' => 'The module that each tag will be handled by, per-format',
    'fields' => array(
      // Key
      'name' => array(
        'description' => 'Identifies the tag, and serves also to recognize it in text',
        'type' => 'varchar',
        'not null' => TRUE,
        'length' => 32,
      ),
      'format' => array(
        'description' => 'Format ID - distinguishes the different format settings. -1 for global settings.',
        'type' => 'int',
        'size' => 'small',
        'not null' => TRUE,
      ),
      // Options
      'module' => array(
        'description' => 'The system name of the module that handles this tag',
        'type' => 'varchar',
        'not null' => TRUE,
        'length' => 32,
      ),
      'weight' => array(
        'description' => 'Tags are prioritized by weight, then by name',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
      ),
      'enabled' => array(
        'description' => 'Whether this tag is currently enabled',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'name',
      'format',
    ),
  );
  return $schema;
}