You are here

function _xbbcode_build_descriptions in Extensible BBCode 8.2

Same name and namespace in other branches
  1. 8 xbbcode.inc \_xbbcode_build_descriptions()
  2. 7 xbbcode.inc \_xbbcode_build_descriptions()

Concatenate a tag's descriptions, making all but one invisible.

Parameters

$tag: The name of the tag.

$handlers: The info from each module that provides the tag, keyed by module name.

$selected: (optional for a single handler) The name of the active handler.

Return value

The HTML code.

1 call to _xbbcode_build_descriptions()
XBBCodeHandlerForm::buildFormHandlers in src/Form/XBBCodeHandlerForm.php
Generate the handler subform.

File

./xbbcode.inc, line 95
General library of internal functions only called by this module.

Code

function _xbbcode_build_descriptions($name, $handlers, $selected = NULL) {
  reset($handlers);
  if (!$selected) {
    $selected = key($handlers);
  }
  $descriptions = '';
  foreach ($handlers as $module => $info) {
    $class = $module == $selected ? 'visible' : 'invisible';
    if (isset($info['description'])) {
      $descriptions .= "<span class='tag-{$name} module-{$module} xbbcode-description-{$class}'>{$info['description']}</span>\n";
    }
  }
  return $descriptions;
}