You are here

function xbbcode_help in Extensible BBCode 8

Same name and namespace in other branches
  1. 5 xbbcode.module \xbbcode_help()
  2. 6 xbbcode.module \xbbcode_help()
  3. 7 xbbcode.module \xbbcode_help()

Implements hook_help().

File

./xbbcode.module, line 176
The main module file containing hook implementations.

Code

function xbbcode_help($section) {
  if ($section == 'admin/help#xbbcode') {
    $text = '<p>' . t('How to write the replacement value for a new custom XBBCode tag:') . '</p>';
    $text .= '<h3>' . t('Static text') . '</h3>';
    $text .= '<p>' . t('Enter the HTML code that should replace [tag=hello]world[/tag]. The following variables are available to you.') . '</p>';
    $text .= '<ul>';
    $text .= '<li>' . t('<code>{option}</code> will be replaced with "hello" in the above example.') . '</li>';
    $text .= '<li>' . t('<code>{content}</code> will be replaced with the text "world".') . '</li>';
    $text .= '</ul>';
    $text .= '<h3>' . t('Multiple attributes') . '</h3>';
    $text .= '<p>' . t('Your tag can accept multiple attributes in the form [tag arg1=value1 arg2="value 2"]content[/tag]. In this example, you will have access to the following variables.') . '</p>';
    $text .= '<ul>';
    $text .= '<li>' . t('<code>{arg1}</code> will be replaced with "val1".') . '</li>';
    $text .= '<li>' . t('<code>{arg2}</code> will be replaced with val2.') . '</li>';
    $text .= '<li>' . t('<code>{content}</code> is replaced by "content".') . '</li>';
    $text .= '</ul>';
    $text .= '<h3>' . t('PHP Code') . '</h3>';
    $text .= '<p>' . t('Enter the PHP code (including <code>&lt;?php ?&gt;</code>) that should be executed. The variables <code>$tag->content</code> and <code>$tag->option</code> contain the tag content and option; <code>$tag->attr(\'name\')</code> will return the value of the "name" attribute.') . '</p>';
    $text .= '<p>' . t('As an example, [php=Label for this Code]Some PHP Code[/php] might be replaced by this code:') . '</p>';
    $text .= <<<END
    <div class="codeblock">
      &lt;label&gt;\$tag->option&lt;/label&gt;
      &lt;code&gt;
        &lt;?=highlight_string(\$tag->content)?&gt;
      &lt;/code&gt;
    </div>
END;
    $text .= '<p>' . t('You may return your output by printing it or using return.') . '</p>';
    return $text;
  }
}