2.2.8.1. BBCode

The BBCode plug-in component defines default BBCode data in the .xml file, including BBCode tags, for example, I, B, U, SIZE, COLOR.

When the BBCode Service runs, it will get values returned from the BBCode plug-in component to initialize default BBCode data.

Configuration of default BBCode data

The default BBCode data is configured in the bbcodes-configuration.xml file.

In particular, at runtime of BBCode Service, the BBCode plug-in component is called. Then, the bbcodes-configuration.xml file will be executed, and the component-plugin named registerBBCodePlugin will be referred to org.exoplatform.ks.bbcode.spi.BBCodePlugin to execute some objects that will generate default data.


<component-plugin>
  <name>forum.default.bbcodes</name>
  <set-method>registerBBCodePlugin</set-method>
  <type>org.exoplatform.forum.bbcode.spi.BBCodePlugin</type>
  <description>default supported BBCodes</description>
  <init-params>
    <object-param>
      <name>I</name>
      <description>set text in italic</description>
      <object type="org.exoplatform.forum.bbcode.spi.BBCodeData">
        <field name="tagName">
          <string>I</string>
        </field>
        <field name="replacement">
          <string>&lt;i&gt;{param}&lt;/i&gt;</string>
        </field>
        <field name="description">
          <string>Set text in italic</string>
        </field>
        <field name="example">
          <string>[I]This text is italic[/I]</string>
        </field>
        <field name="isOption">
          <string>false</string>
        </field>
        <field name="isActive">
          <string>true</string>
        </field>
      </object>
    </object-param>

    <object-param>
      <name>B</name>
      <description></description>
      <object type="org.exoplatform.forum.bbcode.spi.BBCodeData">
        <field name="tagName">
          <string>B</string>
        </field>
        <field name="replacement">
          <string>&lt;strong&gt;{param}&lt;/strong&gt;</string>
        </field>
        <field name="description">
          <string>Set text in bold</string>
        </field>
        <field name="example">
          <string>[B]This text is bold[/B]</string>
        </field>
        <field name="isOption">
          <string>false</string>
        </field>
        <field name="isActive">
          <string>true</string>
        </field>
      </object>
    </object-param>

    <object-param>
      ...

    </object-param>
  </init-params>
</component-plugin>
NameSet methodTypeDescription
forum.default.bbcodes registerBBCodePluginorg.exoplatform.ks.bbcode.spi.BBCodePluginDefines formats for data displayed on UI.

<object type="org.exoplatform.forum.bbcode.spi.BBCodeData">
  <field name="tagName">
    <string>I</string>
  </field>
  <field name="replacement">
    <string>&lt;i&gt;{param}&lt;/i&gt;</string>
  </field>
  <field name="description">
    <string>Set text in italic</string>
  </field>
  <field name="example">
    <string>[I]This text is italic[/I]</string>
  </field>
  <field name="isOption">
    <string>false</string>
  </field>
  <field name="isActive">
    <string>true</string>
  </field>
</object> 

<field name="tagName">
  <string>I</string>
</field>
<field name="replacement">
  <string>&lt;i&gt;{param}&lt;/i&gt;</string>
</field>
<field name="description">
  <string>Set text in italic</string>
</field>
<field name="example">
  <string>[I]This text is italic[/I]</string>
</field>
<field name="isOption">
  <string>false</string>
</field>
<field name="isActive">
  <string>true</string>
</field>

In which:

Field nameValueDescription
tagName string The text for the BBCode, which is put between two square brackets ([ ]). For example, for the bold tag, if you type [b], the BBCode tag will be b without any square brackets ([ ]).
replacement string The HTML code that replaces the BBCode entered by the user. Make sure that you include {param} to insert the text between opening and closing BBCode tags, and {option} for the parameter within the BBCode tag. You can only use option if 'Use Option' is selected.
description string The piece of text to describe the BBCode tag, including HTML tags if you want.
example string The sample piece of BBCode to use as an example for the particular BBCode. For example, to demonstrate the usage of the [b] tag, enter [b]text[/b].
isOption true, false Selects the [tag=option] [/tag] style tag, rather than just a [tag][/tag] style tag. This function will be created if you select this option.
isActive true, false Activates the BBCode tag.
Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus