<?xml version="1.0" encoding="utf-8"?>
<!-- generator="FeedCreator 1.7.2-ppt DokuWiki" -->
<?xml-stylesheet href="https://wiki.oxwall.com/lib/exe/css.php?s=feed" type="text/css"?>
<rdf:RDF
    xmlns="http://purl.org/rss/1.0/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
    xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel rdf:about="https://wiki.oxwall.com/feed.php">
        <title>Oxwall Software Documentation dev:begin</title>
        <description></description>
        <link>https://wiki.oxwall.com/</link>
        <image rdf:resource="https://wiki.oxwall.com/lib/tpl/dokuwiki/images/favicon.ico" />
       <dc:date>2026-05-01T09:23:09+00:00</dc:date>
        <items>
            <rdf:Seq>
                <rdf:li rdf:resource="https://wiki.oxwall.com/dev:begin:beginners"/>
                <rdf:li rdf:resource="https://wiki.oxwall.com/dev:begin:crash-course"/>
                <rdf:li rdf:resource="https://wiki.oxwall.com/dev:begin:index"/>
                <rdf:li rdf:resource="https://wiki.oxwall.com/dev:begin:widget"/>
            </rdf:Seq>
        </items>
    </channel>
    <image rdf:about="https://wiki.oxwall.com/lib/tpl/dokuwiki/images/favicon.ico">
        <title>Oxwall Software Documentation</title>
        <link>https://wiki.oxwall.com/</link>
        <url>https://wiki.oxwall.com/lib/tpl/dokuwiki/images/favicon.ico</url>
    </image>
    <item rdf:about="https://wiki.oxwall.com/dev:begin:beginners">
        <dc:format>text/html</dc:format>
        <dc:date>2012-10-24T11:05:06+00:00</dc:date>
        <title>Getting started with Oxwall development</title>
        <link>https://wiki.oxwall.com/dev:begin:beginners</link>
        <description>
&lt;h1 class=&quot;sectionedit1&quot; id=&quot;getting-started-with-oxwall-development&quot;&gt;Getting started with Oxwall development&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;
&lt;ol&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Sign up at &lt;a href=&quot;http://www.oxwall.org&quot; class=&quot;urlextern&quot; title=&quot;http://www.oxwall.org&quot;  rel=&quot;nofollow&quot;&gt;Oxwall.org&lt;/a&gt;. We support Facebook Connect. You will need Oxwall.org account to obtain your &lt;a href=&quot;https://wiki.oxwall.com/dev:developer-key&quot; class=&quot;wikilink1&quot; title=&quot;dev:developer-key&quot;&gt;Developer Key&lt;/a&gt;.&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Review and take into account &lt;a href=&quot;https://wiki.oxwall.com/dev:core:coding-standards&quot; class=&quot;wikilink1&quot; title=&quot;dev:core:coding-standards&quot;&gt;code conventions&lt;/a&gt; adopted by the Oxwall team. Seriously people, open source is when people respect each other.&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;/div&gt;
&lt;!-- EDIT1 SECTION &quot;Getting started with Oxwall development&quot; [1-396] --&gt;
&lt;h2 class=&quot;sectionedit2&quot; id=&quot;crash-course&quot;&gt;Crash course&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
Impatient to get your hands dirty? Try out our &lt;a href=&quot;https://wiki.oxwall.com/dev:crash-course&quot; class=&quot;wikilink1&quot; title=&quot;dev:crash-course&quot;&gt;plugin development crash course&lt;/a&gt;.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT2 SECTION &quot;Crash course&quot; [397-] --&gt;</description>
    </item>
    <item rdf:about="https://wiki.oxwall.com/dev:begin:crash-course">
        <dc:format>text/html</dc:format>
        <dc:date>2012-10-24T11:05:20+00:00</dc:date>
        <title>Plugin Development Crash Course</title>
        <link>https://wiki.oxwall.com/dev:begin:crash-course</link>
        <description>
&lt;h1 class=&quot;sectionedit1&quot; id=&quot;plugin-development-crash-course&quot;&gt;Plugin Development Crash Course&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
This is a short Oxwall plugin development crash course that is based on the existing &lt;a href=&quot;http://www.oxwall.org/store/item/13&quot; class=&quot;urlextern&quot; title=&quot;http://www.oxwall.org/store/item/13&quot;  rel=&quot;nofollow&quot;&gt;Contact Us&lt;/a&gt; plugin. Let&amp;#039;s see how it was created step by step.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT1 SECTION &quot;Plugin Development Crash Course&quot; [1-235] --&gt;
&lt;h2 class=&quot;sectionedit2&quot; id=&quot;plugin-files&quot;&gt;Plugin files&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
So we begin. We need to create a contact form for sending members&amp;#039; feedback to site administration.
&lt;/p&gt;

&lt;p&gt;
Create &lt;strong&gt;contactus&lt;/strong&gt; folder (this is also our &lt;a href=&quot;https://wiki.oxwall.com/dev:plugin-key&quot; class=&quot;wikilink1&quot; title=&quot;dev:plugin-key&quot;&gt;plugin key&lt;/a&gt; in this case) in the &lt;strong&gt;ow_plugins&lt;/strong&gt; folder. This will be the plugin root folder where we will be performing all the work.
&lt;/p&gt;

&lt;p&gt;
The plugin root folder should contain &lt;strong&gt;init.php&lt;/strong&gt; file. Here we can add new routes and autoload class rules, bind events etc. Let&amp;#039;s leave this file empty for now. This file will be executed every time your plugin is active.
&lt;/p&gt;

&lt;p&gt;
Now let&amp;#039;s create &lt;strong&gt;plugin.xml&lt;/strong&gt; file - this file should contain our plugin information.
&lt;/p&gt;

&lt;p&gt;
&lt;pre class=&quot;code xml&quot;&gt;&lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;?xml&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;version&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;1.0&amp;quot;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;encoding&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;UTF-8&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;plugin&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
	&lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;name&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Contact Us&lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/name&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
	&lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;key&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;your_plugin_key_here&lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/key&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
	&lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;description&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&amp;quot;Contact us&amp;quot; page with the ability to choose departments (email addresses).&lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/description&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;author&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Skalfa LLC&lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/author&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;authorEmail&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;plugins@oxwall.org&lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/authorEmail&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
	&lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;authorUrl&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;http://www.skalfa.com&lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/authorUrl&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
	&lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;developerKey&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;your_developer_key_here&lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/developerKey&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;build&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;1&lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/build&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;copyright&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;(C) 2009 Skalfa LLC. All rights reserved.&lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/copyright&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
	&lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;license&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;The BSD License&lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/license&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;licenseUrl&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;http://www.opensource.org/licenses/bsd-license.php&lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/licenseUrl&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/plugin&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;

&lt;/p&gt;

&lt;p&gt;
&lt;strong&gt;Important&lt;/strong&gt;: Note these strings:
&lt;pre class=&quot;code xml&quot;&gt;	&lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;key&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;your_plugin_key_here&lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/key&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
        ...
	&lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;developerKey&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;your_developer_key_here&lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/developerKey&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;

Those should be your &lt;a href=&quot;https://wiki.oxwall.com/dev:plugin-key&quot; class=&quot;wikilink1&quot; title=&quot;dev:plugin-key&quot;&gt;plugin key&lt;/a&gt; and &lt;a href=&quot;https://wiki.oxwall.com/dev:developer-key&quot; class=&quot;wikilink1&quot; title=&quot;dev:developer-key&quot;&gt;developer key&lt;/a&gt;, respectively. They should be correct, otherwise you may face problems upon submitting your plugin or auto-updating it in the admin area.
&lt;/p&gt;

&lt;p&gt;
Now we should install and activate our plugin. For that we should create the following files in the root folder of our plugin: &lt;strong&gt;install.php&lt;/strong&gt;, &lt;strong&gt;uninstall.php&lt;/strong&gt;, &lt;strong&gt;activate.php&lt;/strong&gt; and &lt;strong&gt;deactivate.php&lt;/strong&gt;.
&lt;/p&gt;

&lt;p&gt;
Add the following code to &lt;strong&gt;install.php&lt;/strong&gt; file:
&lt;/p&gt;

&lt;p&gt;
&lt;pre class=&quot;code php&quot;&gt;BOL_LanguageService&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;addPrefix&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'contactus'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'Contact Us'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

&lt;/p&gt;

&lt;p&gt;
We&amp;#039;ll explain its functional purpose a bit later. Leave the rest of the files empty for now. That&amp;#039;s it, our plugin is ready to be installed :)
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT2 SECTION &quot;Plugin files&quot; [236-2379] --&gt;
&lt;h2 class=&quot;sectionedit3&quot; id=&quot;plugin-installation&quot;&gt;Plugin installation&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
Yes, it&amp;#039;s time to install your plugin before you actually started real development. Go to &lt;strong&gt;Admin area → Plugins → Available Plugins&lt;/strong&gt;. Click &lt;strong&gt;Install&lt;/strong&gt; on your new plugin.
&lt;/p&gt;

&lt;p&gt;
Voila - our plugin has been successfully installed and activated. This should create necessary database records for the normal functioning of the new plugin.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT3 SECTION &quot;Plugin installation&quot; [2380-2748] --&gt;
&lt;h2 class=&quot;sectionedit4&quot; id=&quot;creating-a-page&quot;&gt;Creating a page&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
Oxwall employs &lt;a href=&quot;http://en.wikipedia.org/wiki/Model-View-Controller&quot; class=&quot;urlextern&quot; title=&quot;http://en.wikipedia.org/wiki/Model-View-Controller&quot;  rel=&quot;nofollow&quot;&gt;MVC&lt;/a&gt; pattern. Let&amp;#039;s create two folders: &lt;strong&gt;controllers&lt;/strong&gt; and &lt;strong&gt;views&lt;/strong&gt;. Create one more &lt;strong&gt;controllers&lt;/strong&gt; folder in the &lt;strong&gt;views&lt;/strong&gt; folder. Create the first controller in the root &lt;strong&gt;controllers&lt;/strong&gt; folder. Let&amp;#039;s name it &lt;strong&gt;contact.php&lt;/strong&gt;.
&lt;/p&gt;

&lt;p&gt;
This file&amp;#039;s content should be as follows:
&lt;/p&gt;

&lt;p&gt;
&lt;pre class=&quot;code php&quot;&gt;&lt;span class=&quot;kw2&quot;&gt;class&lt;/span&gt; CONTACTUS_CTRL_Contact &lt;span class=&quot;kw2&quot;&gt;extends&lt;/span&gt; OW_ActionController 
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt; 
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;/p&gt;

&lt;p&gt;
&lt;strong&gt;Note&lt;/strong&gt;: The name of the controller class should start with a prefix consisting of the &lt;a href=&quot;https://wiki.oxwall.com/dev:plugin-key&quot; class=&quot;wikilink1&quot; title=&quot;dev:plugin-key&quot;&gt;plugin key&lt;/a&gt; (in upper case) and the word &amp;#039;CTRL&amp;#039; separated by an underscore.
&lt;/p&gt;

&lt;p&gt;
&lt;strong&gt;Note&lt;/strong&gt;: All controllers should be inherited from &lt;strong&gt;OW_ActionController&lt;/strong&gt; or its child classes.
&lt;/p&gt;

&lt;p&gt;
&lt;strong&gt;Note&lt;/strong&gt;: The file containing class declaration should be named according to the following rule - remove prefix from the class name, change the letters from upper to lower case following an underscore. For example, &lt;strong&gt;MYPLUGIN_CTRL_SuperPuper&lt;/strong&gt; class will have a file named &lt;strong&gt;super_puper.php&lt;/strong&gt;.
&lt;/p&gt;

&lt;p&gt;
Let&amp;#039;s create the first action inside of the class: 
&lt;/p&gt;

&lt;p&gt;
&lt;pre class=&quot;code php&quot;&gt;    &lt;span class=&quot;kw2&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;function&lt;/span&gt; index&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; 
    &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt; 
        &lt;span class=&quot;re0&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;setPageTitle&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;&amp;quot;Contact Us&amp;quot;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt; 
        &lt;span class=&quot;re0&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;setPageHeading&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;&amp;quot;Contact Us&amp;quot;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt; 
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt; &lt;/pre&gt;

&lt;/p&gt;

&lt;p&gt;
An action is basically any class method with public access attribute.
&lt;/p&gt;

&lt;p&gt;
Let&amp;#039;s set page title and page heading inside of this method by calling standard methods of the &lt;strong&gt;OW_ActionController&lt;/strong&gt; class.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT4 SECTION &quot;Creating a page&quot; [2749-4183] --&gt;
&lt;h2 class=&quot;sectionedit5&quot; id=&quot;localization&quot;&gt;Localization&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
In the above example we set page title directly, without using localization (languages mechanism).
&lt;/p&gt;

&lt;p&gt;
For our contact form to support various languages go to the admin panel through the following &lt;abbr title=&quot;Uniform Resource Locator&quot;&gt;URL&lt;/abbr&gt; &lt;strong&gt;&amp;lt;domain&amp;gt;/admin/dev-tools/languages&lt;/strong&gt;. Note that this is a page available to developers only and it&amp;#039;s more powerful than the standard language editing interface.
&lt;/p&gt;

&lt;p&gt;
Click the &lt;strong&gt;Add New Text&lt;/strong&gt; button. It will take you to a form for adding a new key. Choose the section whose name matches the name of the &amp;#039;Contact Us&amp;#039; plugin (this section was added during the plugin installation with the code we insterted to the &lt;strong&gt;install.php&lt;/strong&gt; file). 
Now, enter the key name &lt;strong&gt;index_page_title&lt;/strong&gt; and the appropriate text. Add the &lt;strong&gt;index_page_heading&lt;/strong&gt; key in the same way.  
&lt;/p&gt;

&lt;p&gt;
You can get text for the key in a current language by calling &lt;strong&gt;text()&lt;/strong&gt; method of the Language object. Pass the plugin key and the language key as parameters. Change the following lines in the action code: 
&lt;pre class=&quot;code php&quot;&gt;        &lt;span class=&quot;re0&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;setPageTitle&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;&amp;quot;Contact Us&amp;quot;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt; 
        &lt;span class=&quot;re0&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;setPageHeading&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;&amp;quot;Contact Us&amp;quot;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt; &lt;/pre&gt;

to the ones below: 
&lt;pre class=&quot;code php&quot;&gt;        &lt;span class=&quot;re0&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;setPageTitle&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;OW&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getLanguage&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'contactus'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'index_page_title'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt; 
        &lt;span class=&quot;re0&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;setPageHeading&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;OW&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getLanguage&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'contactus'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'index_page_heading'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt; &lt;/pre&gt;

&lt;/p&gt;

&lt;p&gt;
That&amp;#039;s it. Now the title and heading can be displayed in any language.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT5 SECTION &quot;Localization&quot; [4184-5576] --&gt;
&lt;h2 class=&quot;sectionedit6&quot; id=&quot;page-routing&quot;&gt;Page routing&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
For our page to display correctly we should assign a view for the action. For that we need to create an empty file &lt;strong&gt;contact_index.html&lt;/strong&gt; in the &lt;strong&gt;views/controllers/&lt;/strong&gt; folder. As you can see, the view name contains of the controller file name and the action name separated by an underscore.  
&lt;/p&gt;

&lt;p&gt;
Finally, we can take a look at our page. The &lt;abbr title=&quot;Uniform Resource Locator&quot;&gt;URL&lt;/abbr&gt; of the page looks like this: &lt;strong&gt;&amp;lt;domain&amp;gt;/contactus/contact/index&lt;/strong&gt;
&lt;/p&gt;

&lt;p&gt;
That&amp;#039;s what we are going to see by opening this &lt;abbr title=&quot;Uniform Resource Locator&quot;&gt;URL&lt;/abbr&gt; in a browser: 
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;https://wiki.oxwall.com/_detail/dev:contact1.png?id=dev%3Abegin%3Acrash-course&quot; class=&quot;media&quot; title=&quot;dev:contact1.png&quot;&gt;&lt;img src=&quot;https://wiki.oxwall.com/_media/dev:contact1.png&quot; class=&quot;media&quot; title=&quot;Empty page&quot; alt=&quot;Empty page&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
The &lt;abbr title=&quot;Uniform Resource Locator&quot;&gt;URL&lt;/abbr&gt; looks rather lengthy. No worries though - Oxwall supports nice urls. For our page to be available from a shorter &lt;abbr title=&quot;Uniform Resource Locator&quot;&gt;URL&lt;/abbr&gt; (from example, &lt;strong&gt;&amp;lt;domain&amp;gt;/contact&lt;/strong&gt;) we should add the following line to the previously created &lt;strong&gt;init.php&lt;/strong&gt; file: 
&lt;/p&gt;

&lt;p&gt;
&lt;pre class=&quot;code php&quot;&gt;OW&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getRouter&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;addRoute&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;new&lt;/span&gt; OW_Route&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'contactus.index'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'contact'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;CONTACTUS_CTRL_Contact&amp;quot;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'index'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt; &lt;/pre&gt;

&lt;/p&gt;

&lt;p&gt;
This line has added a new route.
&lt;/p&gt;

&lt;p&gt;
&lt;strong&gt;Parameters&lt;/strong&gt;:
&lt;/p&gt;
&lt;ol&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; route name, &lt;strong&gt;contactus.index&lt;/strong&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; path&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; controller class name&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; name of the action the route points to.&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;
It is desirable to make the route name compound, like this - &lt;strong&gt;&amp;lt;plugin_key&amp;gt;.&amp;lt;name&amp;gt;&lt;/strong&gt;, because the route name should be unique. Now our page opens from the following address: &lt;strong&gt;&amp;lt;domain&amp;gt;/contact&lt;/strong&gt;
&lt;/p&gt;

&lt;p&gt;
But there is one small problem - the site users cannot see our page. To make the page accessible, let&amp;#039;s add a link to the form to the bottom menu. For that we should create &lt;strong&gt;bottom_menu_item&lt;/strong&gt; key in Languages with the prefix of our plug-in, and &amp;#039;Contact us&amp;#039; as the value.
Add the following code to the &lt;strong&gt;activate.php&lt;/strong&gt; file: 
&lt;/p&gt;

&lt;p&gt;
&lt;pre class=&quot;code php&quot;&gt;OW&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getNavigation&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;addMenuItem&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;OW_Navigation&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;BOTTOM&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'contactus.index'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'contactus'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'bottom_menu_item'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; OW_Navigation&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;VISIBLE_FOR_ALL&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

&lt;/p&gt;

&lt;p&gt;
Also, add the code below to &lt;strong&gt;deactivate.php&lt;/strong&gt;:
&lt;/p&gt;

&lt;p&gt;
&lt;pre class=&quot;code php&quot;&gt;OW&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getNavigation&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;deleteMenuItem&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'contactus'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'bottom_menu_item'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

&lt;/p&gt;

&lt;p&gt;
Now go to the &lt;strong&gt;&amp;lt;domain&amp;gt;/admin/plugins page&lt;/strong&gt;. Deactivate the plug-in, and then reactivate it. That&amp;#039;s it. Now, when we enter the index page, we can see the “Contact us” element in the bottom menu.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT6 SECTION &quot;Page routing&quot; [5577-7674] --&gt;
&lt;h2 class=&quot;sectionedit7&quot; id=&quot;using-forms&quot;&gt;Using forms&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
It&amp;#039;s time to add a contact form to our page. Oxwall has a very convenient mechanism for working with forms.
&lt;/p&gt;

&lt;p&gt;
To start with, let&amp;#039;s declare an array of the contact emails that will be displayed on the contact form. Add to the &lt;strong&gt;index&lt;/strong&gt; action of your controller (meaning &lt;strong&gt;index()&lt;/strong&gt; method in &lt;strong&gt;contact.php&lt;/strong&gt;) the following code:
&lt;/p&gt;

&lt;p&gt;
&lt;pre class=&quot;code php&quot;&gt;&lt;span class=&quot;re0&quot;&gt;$contactEmails&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;a href=&quot;http://www.php.net/array&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;
  &lt;span class=&quot;st_h&quot;&gt;'admin@site.com'&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'Site administration'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;st_h&quot;&gt;'support@site.com'&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'Technical support'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;st_h&quot;&gt;'billing@site.com'&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'Billing department'&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

&lt;/p&gt;

&lt;p&gt;
Let&amp;#039;s also create a shortcut for calling &lt;strong&gt;OW::getLanguage→text()&lt;/strong&gt;:
&lt;/p&gt;

&lt;p&gt;
&lt;pre class=&quot;code php&quot;&gt;&lt;span class=&quot;kw2&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;function&lt;/span&gt; text&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$prefix&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$key&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;a href=&quot;http://www.php.net/array&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;array&lt;/span&gt;&lt;/a&gt; &lt;span class=&quot;re0&quot;&gt;$vars&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; OW&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getLanguage&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$prefix&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$key&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$vars&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;/p&gt;

&lt;p&gt;
Now you can use &lt;strong&gt;$this→text()&lt;/strong&gt; for a short call.
&lt;/p&gt;

&lt;p&gt;
The next step is creating the form object:
&lt;/p&gt;

&lt;p&gt;
&lt;pre class=&quot;code php&quot;&gt;&lt;span class=&quot;re0&quot;&gt;$form&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;new&lt;/span&gt; Form&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'contact_form'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

&lt;/p&gt;

&lt;p&gt;
We should add the following fields to the form: “to”(as a drop-down list), and three text fields: “from”, “subject” and “message”.
Let&amp;#039;s do this using the code below:
&lt;/p&gt;

&lt;p&gt;
&lt;pre class=&quot;code php&quot;&gt;&lt;span class=&quot;re0&quot;&gt;$fieldTo&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;new&lt;/span&gt; Selectbox&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'to'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kw1&quot;&gt;foreach&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$contactEmails&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$email&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$label&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
  &lt;span class=&quot;re0&quot;&gt;$fieldTo&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;addOption&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$email&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$label&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&lt;span class=&quot;re0&quot;&gt;$fieldTo&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;setRequired&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;re0&quot;&gt;$fieldTo&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;setHasInvitation&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw4&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;re0&quot;&gt;$fieldTo&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;setLabel&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'contactus'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'form_label_to'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;re0&quot;&gt;$form&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;addElement&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$fieldTo&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;re0&quot;&gt;$fieldFrom&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;new&lt;/span&gt; TextField&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'from'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;re0&quot;&gt;$fieldFrom&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;setLabel&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'contactus'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'form_label_from'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;re0&quot;&gt;$fieldFrom&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;setRequired&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;re0&quot;&gt;$fieldFrom&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;addValidator&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;new&lt;/span&gt; EmailValidator&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;re0&quot;&gt;$form&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;addElement&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$fieldFrom&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;re0&quot;&gt;$fieldSubject&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;new&lt;/span&gt; TextField&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'subject'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;re0&quot;&gt;$fieldSubject&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;setLabel&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'contactus'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'form_label_subject'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;re0&quot;&gt;$fieldSubject&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;setRequired&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;re0&quot;&gt;$form&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;addElement&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$fieldSubject&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;re0&quot;&gt;$fieldMessage&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;new&lt;/span&gt; Textarea&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'message'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;re0&quot;&gt;$fieldMessage&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;setLabel&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'contactus'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'form_label_message'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;re0&quot;&gt;$fieldMessage&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;setRequired&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;re0&quot;&gt;$form&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;addElement&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$fieldMessage&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;// Using captcha here to prevent bot spam&lt;/span&gt;
&lt;span class=&quot;re0&quot;&gt;$fieldCaptcha&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;new&lt;/span&gt; CaptchaField&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'captcha'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;re0&quot;&gt;$fieldCaptcha&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;setLabel&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'contactus'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'form_label_captcha'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;re0&quot;&gt;$form&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;addElement&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$fieldCaptcha&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;re0&quot;&gt;$submit&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;new&lt;/span&gt; Submit&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'send'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;re0&quot;&gt;$submit&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;setValue&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'contactus'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'form_label_submit'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;re0&quot;&gt;$form&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;addElement&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$submit&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

&lt;/p&gt;

&lt;p&gt;
Let&amp;#039;s take a detailed look at adding form fields.
&lt;/p&gt;

&lt;p&gt;
First we created the &lt;strong&gt;$fieldFrom&lt;/strong&gt; object of the &lt;strong&gt;TextField&lt;/strong&gt; type by setting the form element name in the constructor. We should set the field label using &lt;strong&gt;setLabel()&lt;/strong&gt;. Don&amp;#039;t forget to add keys for all the form fields using &lt;strong&gt;admin/dev-tools/languages&lt;/strong&gt; page on your site.
&lt;/p&gt;

&lt;p&gt;
Make the field required for filling in with &lt;strong&gt;setRequired()&lt;/strong&gt;. One can add only a sender&amp;#039;s email into this field, so let&amp;#039;s add a standard email validator to the field by calling &lt;strong&gt;addValidator()&lt;/strong&gt;.
We can describe custom validators, and add them to the form elements. Please note that you can define your own form elements besides the standard ones by inheriting them from the &lt;strong&gt;FormElement&lt;/strong&gt; class.
&lt;/p&gt;

&lt;p&gt;
The last thing we should do here is add our element to the form using the &lt;strong&gt;addElement()&lt;/strong&gt; form method. Pay attention to how easily we&amp;#039;ve added CAPTCHA by using the standard &lt;strong&gt;CaptchaField&lt;/strong&gt; form element.
&lt;/p&gt;

&lt;p&gt;
Now we should add our form to the controller by using the following code:
&lt;/p&gt;

&lt;p&gt;
&lt;pre class=&quot;code php&quot;&gt;&lt;span class=&quot;re0&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;addForm&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$form&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

&lt;/p&gt;

&lt;p&gt;
For the form to show up on the page, we should set its markup on the controller action view.
Let&amp;#039;s add the following code to the &lt;strong&gt;views/controllers/contact_index.html&lt;/strong&gt; file:
&lt;/p&gt;

&lt;p&gt;
&lt;pre class=&quot;code smarty&quot;&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;form &lt;span class=&quot;kw6&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;'contact_form'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&lt;span class=&quot;sc2&quot;&gt;&amp;lt;table class=&amp;quot;ow_table_1 ow_form ow_automargin ow_superwide&amp;quot;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;sc2&quot;&gt;&amp;lt;tr class=&amp;quot;ow_alt1&amp;quot;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;sc2&quot;&gt;&amp;lt;td class=&amp;quot;ow_label&amp;quot;&amp;gt;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;label &lt;span class=&quot;kw6&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;'to'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
&lt;span class=&quot;sc2&quot;&gt;&amp;lt;td class=&amp;quot;ow_value&amp;quot;&amp;gt;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;input &lt;span class=&quot;kw6&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;'to'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;error &lt;span class=&quot;kw6&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;'to'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
&lt;span class=&quot;sc2&quot;&gt;&amp;lt;/tr&amp;gt;&lt;/span&gt;
&lt;span class=&quot;sc2&quot;&gt;&amp;lt;tr class=&amp;quot;ow_alt2&amp;quot;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;sc2&quot;&gt;&amp;lt;td class=&amp;quot;ow_label&amp;quot;&amp;gt;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;label &lt;span class=&quot;kw6&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;'from'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
&lt;span class=&quot;sc2&quot;&gt;&amp;lt;td class=&amp;quot;ow_value&amp;quot;&amp;gt;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;input &lt;span class=&quot;kw6&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;'from'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;error &lt;span class=&quot;kw6&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;'from'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
&lt;span class=&quot;sc2&quot;&gt;&amp;lt;/tr&amp;gt;&lt;/span&gt;
&lt;span class=&quot;sc2&quot;&gt;&amp;lt;tr class=&amp;quot;ow_alt1&amp;quot;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;sc2&quot;&gt;&amp;lt;td class=&amp;quot;ow_label&amp;quot;&amp;gt;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;label &lt;span class=&quot;kw6&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;'subject'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
&lt;span class=&quot;sc2&quot;&gt;&amp;lt;td class=&amp;quot;ow_value&amp;quot;&amp;gt;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;input &lt;span class=&quot;kw6&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;'subject'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;error &lt;span class=&quot;kw6&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;'subject'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
&lt;span class=&quot;sc2&quot;&gt;&amp;lt;/tr&amp;gt;&lt;/span&gt;
&lt;span class=&quot;sc2&quot;&gt;&amp;lt;tr class=&amp;quot;ow_alt2&amp;quot;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;sc2&quot;&gt;&amp;lt;td class=&amp;quot;ow_label&amp;quot;&amp;gt;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;label &lt;span class=&quot;kw6&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;'message'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
&lt;span class=&quot;sc2&quot;&gt;&amp;lt;td class=&amp;quot;ow_value&amp;quot;&amp;gt;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;input &lt;span class=&quot;kw6&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;'message'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;error &lt;span class=&quot;kw6&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;'message'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
&lt;span class=&quot;sc2&quot;&gt;&amp;lt;/tr&amp;gt;&lt;/span&gt;
&lt;span class=&quot;sc2&quot;&gt;&amp;lt;tr class=&amp;quot;ow_alt1&amp;quot;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;sc2&quot;&gt;&amp;lt;td class=&amp;quot;ow_label&amp;quot;&amp;gt;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;label &lt;span class=&quot;kw6&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;'captcha'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
&lt;span class=&quot;sc2&quot;&gt;&amp;lt;td class=&amp;quot;ow_value ow_center&amp;quot;&amp;gt;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;input &lt;span class=&quot;kw6&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;'captcha'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;error &lt;span class=&quot;kw6&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;'captcha'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
&lt;span class=&quot;sc2&quot;&gt;&amp;lt;/tr&amp;gt;&lt;/span&gt;
&lt;span class=&quot;sc2&quot;&gt;&amp;lt;tr&amp;gt;&lt;/span&gt;
&lt;span class=&quot;sc2&quot;&gt;&amp;lt;td class=&amp;quot;ow_center&amp;quot; colspan=&amp;quot;2&amp;quot;&amp;gt;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;submit &lt;span class=&quot;kw6&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;'send'&lt;/span&gt; class&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;'ow_button ow_ic_mail'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
&lt;span class=&quot;sc2&quot;&gt;&amp;lt;/tr&amp;gt;&lt;/span&gt;
&lt;span class=&quot;sc2&quot;&gt;&amp;lt;/table&amp;gt;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;/&lt;/span&gt;form&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;/p&gt;

&lt;p&gt;
This is a usual &lt;abbr title=&quot;HyperText Markup Language&quot;&gt;HTML&lt;/abbr&gt; code with &lt;a href=&quot;http://www.smarty.net/&quot; class=&quot;urlextern&quot; title=&quot;http://www.smarty.net/&quot;  rel=&quot;nofollow&quot;&gt;Smarty&lt;/a&gt; tags. This form is declared with an opening tag &lt;strong&gt;{form name=&amp;#039;&amp;#039;}&lt;/strong&gt; with a required &lt;strong&gt;name&lt;/strong&gt; attribute and the closing tag &lt;strong&gt;{/form}&lt;/strong&gt;.
The form elements are declared with the following tags: &lt;strong&gt;{label name=&amp;#039;&amp;#039;}&lt;/strong&gt;, &lt;strong&gt;{input name=&amp;#039;&amp;#039;}&lt;/strong&gt; and &lt;strong&gt;{error name=&amp;#039;&amp;#039;}&lt;/strong&gt;. The &lt;strong&gt;name&lt;/strong&gt; attribute is required for these tags.
&lt;/p&gt;

&lt;p&gt;
In the end we should get the following page:
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;https://wiki.oxwall.com/_detail/dev:contact2.png?id=dev%3Abegin%3Acrash-course&quot; class=&quot;media&quot; title=&quot;dev:contact2.png&quot;&gt;&lt;img src=&quot;https://wiki.oxwall.com/_media/dev:contact2.png&quot; class=&quot;media&quot; title=&quot;Contact form&quot; alt=&quot;Contact form&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
Now it&amp;#039;s time to make our form interactive and functional.
Add the code below to the end of the &lt;strong&gt;index&lt;/strong&gt; action:
&lt;/p&gt;

&lt;p&gt;
&lt;pre class=&quot;code php&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; OW&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getRequest&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;isPost&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$form&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;isValid&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$_POST&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span class=&quot;re0&quot;&gt;$data&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$form&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;getValues&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;re0&quot;&gt;$mail&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; OW&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getMailer&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;createMail&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;re0&quot;&gt;$mail&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;addRecipientEmail&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$data&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'to'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;re0&quot;&gt;$mail&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;setSender&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$data&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'from'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;re0&quot;&gt;$mail&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;setSubject&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$data&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'subject'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;re0&quot;&gt;$mail&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;setTextContent&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$data&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'message'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    OW&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getMailer&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;addToQueue&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$mail&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
    OW&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getSession&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'contactus.dept'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$contactEmails&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$data&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'to'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;re0&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;redirectToAction&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'sent'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;/p&gt;

&lt;p&gt;
Let&amp;#039;s see the code in details. The &lt;strong&gt;OW::getRequest()→isPost()&lt;/strong&gt; call allows us to check whether the data sent by the form using the POST method have been received. Then the &lt;strong&gt;$form→isValid($_POST)&lt;/strong&gt; checks validity of the &lt;strong&gt;$_POST&lt;/strong&gt; array data, and adds the data to the form object. By calling &lt;strong&gt;$data = $form→getValues()&lt;/strong&gt; we get the array containing the form fields. Next, we form a letter with the &lt;strong&gt;Mailer&lt;/strong&gt; object, and add it to the mail-sending queue.
&lt;/p&gt;

&lt;p&gt;
By calling &lt;strong&gt;OW::getSession()&lt;/strong&gt; we get access to the session object. And set a variable to the session using the &lt;strong&gt;set()&lt;/strong&gt; method. This variable is used in the &lt;strong&gt;sent&lt;/strong&gt; action. Please pay attention to how the variable key is formed. It consists of the prefix (which is the &lt;a href=&quot;https://wiki.oxwall.com/dev:plugin-key&quot; class=&quot;wikilink1&quot; title=&quot;dev:plugin-key&quot;&gt;plugin key&lt;/a&gt;) and the variable name separated by a dot. You should do that for your variable not to cross with other plugins&amp;#039; variables by any chance. By the final line &lt;strong&gt;$this→redirectToAction(&amp;#039;sent&amp;#039;)&lt;/strong&gt; we redirect the user to the “sent” page.
&lt;/p&gt;

&lt;p&gt;
Let&amp;#039;s define the action for the “sent” page.
&lt;/p&gt;

&lt;p&gt;
&lt;pre class=&quot;code php&quot;&gt;&lt;span class=&quot;kw2&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;function&lt;/span&gt; sent&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
  &lt;span class=&quot;re0&quot;&gt;$dept&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; OW&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getSession&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;isKeySet&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'contactus.dept'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span class=&quot;re0&quot;&gt;$dept&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; OW&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getSession&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'contactus.dept'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    OW&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getSession&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;delete&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'contactus.dept'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;else&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span class=&quot;re0&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;redirectToAction&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'index'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
  &lt;span class=&quot;re0&quot;&gt;$feedback&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'contactus'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'message_sent'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$dept&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; ? &lt;span class=&quot;kw4&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt; &lt;a href=&quot;http://www.php.net/array&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'dept'&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$dept&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;re0&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;assign&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'feedback'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$feedback&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;/p&gt;

&lt;p&gt;
Here we should check if the variable is available in the session (the &lt;strong&gt;isKeySet&lt;/strong&gt; session method), and if it&amp;#039;s there - we get it (the &lt;strong&gt;get&lt;/strong&gt; session method), and then delete it (the &lt;strong&gt;delete&lt;/strong&gt; session method). Now we should add a dispatch notification text to the &lt;strong&gt;$feedback&lt;/strong&gt; variable and add the variable to the template by using &lt;strong&gt;assign()&lt;/strong&gt; method.
&lt;/p&gt;

&lt;p&gt;
Also, create a &lt;strong&gt;message_sent&lt;/strong&gt; key in Language with the following text “Your message has been sent. {$dept} will reply shortly. Thank you.”. Using &lt;strong&gt;{$dept}&lt;/strong&gt; construction we set the &lt;strong&gt;dept&lt;/strong&gt; key to the template. This key will be replaced by the value sent to the &lt;strong&gt;text&lt;/strong&gt; method. 
Note that we passed the 3rd parameter in calling the &lt;strong&gt;text&lt;/strong&gt; method. It is an array of the &lt;strong&gt;key ⇒ value&lt;/strong&gt; kind. In our case the key name is &lt;strong&gt;dept&lt;/strong&gt;, and the value is the variable received from the session.
&lt;/p&gt;

&lt;p&gt;
Finally, let&amp;#039;s create a view for the &lt;strong&gt;sent&lt;/strong&gt; action. Create &lt;strong&gt;views/controllers/contact_sent.html&lt;/strong&gt; file with the following content:
&lt;/p&gt;

&lt;p&gt;
&lt;pre class=&quot;code smarty&quot;&gt;&lt;span class=&quot;sc2&quot;&gt;&amp;lt;div class=&amp;quot;ow_center&amp;quot;&amp;gt;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$feedback&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;/p&gt;

&lt;p&gt;
We&amp;#039;re done - now it&amp;#039;s possible to send feedback to site administration through the contact form.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT7 SECTION &quot;Using forms&quot; [7675-15809] --&gt;
&lt;h2 class=&quot;sectionedit8&quot; id=&quot;using-database&quot;&gt;Using database&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
Our form has one shortcoming - the contact emails (departments) are hardcoded in &lt;strong&gt;index&lt;/strong&gt; method. Wouldn&amp;#039;t it be great to be able to change them via the admin panel?
&lt;/p&gt;

&lt;p&gt;
Let&amp;#039;s begin with creating backend for storing emails in the database. For that we should create &lt;strong&gt;bol&lt;/strong&gt; folder (meaning &amp;#039;Business Object Layer&amp;#039;) in the plugin root folder. Let&amp;#039;s create 3 files in this folder: &lt;strong&gt;department.php&lt;/strong&gt;, &lt;strong&gt;department_dao.php&lt;/strong&gt;, &lt;strong&gt;service.php&lt;/strong&gt;. We should add DTO (&lt;a href=&quot;http://en.wikipedia.org/wiki/Data_Transfer_Object&quot; class=&quot;urlextern&quot; title=&quot;http://en.wikipedia.org/wiki/Data_Transfer_Object&quot;  rel=&quot;nofollow&quot;&gt;Data Transfer Object&lt;/a&gt;) code to &lt;strong&gt;department.php&lt;/strong&gt;:
&lt;/p&gt;

&lt;p&gt;
&lt;pre class=&quot;code php&quot;&gt;&lt;span class=&quot;kw2&quot;&gt;class&lt;/span&gt; CONTACTUS_BOL_Department &lt;span class=&quot;kw2&quot;&gt;extends&lt;/span&gt; OW_Entity
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span class=&quot;co4&quot;&gt;/**
     * @var string
     */&lt;/span&gt;
    &lt;span class=&quot;kw2&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$email&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;/p&gt;

&lt;p&gt;
DTO is a kind of a table reflection. The rule for naming the DTO class and file is identical to the one for controllers except for one thing - &lt;strong&gt;CTRL&lt;/strong&gt; suffix should be replaced with &lt;strong&gt;BOL&lt;/strong&gt;. Our DTO should be inherited from &lt;strong&gt;OW_Entity&lt;/strong&gt; class.
&lt;/p&gt;

&lt;p&gt;
We should add DAO (&lt;a href=&quot;http://en.wikipedia.org/wiki/Data_access_object&quot; class=&quot;urlextern&quot; title=&quot;http://en.wikipedia.org/wiki/Data_access_object&quot;  rel=&quot;nofollow&quot;&gt;Data Access Object&lt;/a&gt;) code to &lt;strong&gt;department_dao.php&lt;/strong&gt;:
&lt;/p&gt;

&lt;p&gt;
&lt;pre class=&quot;code php&quot;&gt;&lt;span class=&quot;kw2&quot;&gt;class&lt;/span&gt; CONTACTUS_BOL_DepartmentDao &lt;span class=&quot;kw2&quot;&gt;extends&lt;/span&gt; OW_BaseDao
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;co4&quot;&gt;/**
     * Constructor.
     *
     */&lt;/span&gt;
    &lt;span class=&quot;kw2&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;function&lt;/span&gt; __construct&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
        parent&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;__construct&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
    &lt;span class=&quot;co4&quot;&gt;/**
     * Singleton instance.
     *
     * @var CONTACTUS_BOL_DepartmentDao
     */&lt;/span&gt;
    &lt;span class=&quot;kw2&quot;&gt;private&lt;/span&gt; static &lt;span class=&quot;re0&quot;&gt;$classInstance&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;co4&quot;&gt;/**
     * Returns an instance of class (singleton pattern implementation).
     *
     * @return CONTACTUS_BOL_DepartmentDao
     */&lt;/span&gt;
    &lt;span class=&quot;kw2&quot;&gt;public&lt;/span&gt; static &lt;span class=&quot;kw2&quot;&gt;function&lt;/span&gt; getInstance&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$classInstance&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
            &lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$classInstance&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
        &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$classInstance&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;co4&quot;&gt;/**
     * @see OW_BaseDao::getDtoClassName()
     *
     */&lt;/span&gt;
    &lt;span class=&quot;kw2&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;function&lt;/span&gt; getDtoClassName&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'CONTACTUS_BOL_Department'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;co4&quot;&gt;/**
     * @see OW_BaseDao::getTableName()
     *
     */&lt;/span&gt;
    &lt;span class=&quot;kw2&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;function&lt;/span&gt; getTableName&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; OW_DB_PREFIX &lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'contactus_department'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;/p&gt;

&lt;p&gt;
DAO is required for interacting with database. Roughly speaking, DAO maps data from the table to DTO and back. The rule for naming the DAO class and file is identical to the one for controllers with one exception - &lt;strong&gt;CTRL&lt;/strong&gt; suffix should be changed to &lt;strong&gt;BOL&lt;/strong&gt;. Our DAO class is inherited from &lt;strong&gt;OW_BaseDao&lt;/strong&gt; abstract class, and is a &lt;a href=&quot;http://en.wikipedia.org/wiki/Singleton_pattern&quot; class=&quot;urlextern&quot; title=&quot;http://en.wikipedia.org/wiki/Singleton_pattern&quot;  rel=&quot;nofollow&quot;&gt;singleton&lt;/a&gt;. &lt;strong&gt;OW_BaseDao&lt;/strong&gt; contains a number of useful methods for working with database.
&lt;/p&gt;

&lt;p&gt;
Let&amp;#039;s add service class code to &lt;strong&gt;service.php&lt;/strong&gt; for working with departments:
&lt;/p&gt;

&lt;p&gt;
&lt;pre class=&quot;code php&quot;&gt;&lt;span class=&quot;kw2&quot;&gt;class&lt;/span&gt; CONTACTUS_BOL_Service
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span class=&quot;co4&quot;&gt;/**
     * Singleton instance.
     *
     * @var CONTACTUS_BOL_Service
     */&lt;/span&gt;
    &lt;span class=&quot;kw2&quot;&gt;private&lt;/span&gt; static &lt;span class=&quot;re0&quot;&gt;$classInstance&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;co4&quot;&gt;/**
     * Returns an instance of class (singleton pattern implementation).
     *
     * @return CONTACTUS_BOL_Service
     */&lt;/span&gt;
    &lt;span class=&quot;kw2&quot;&gt;public&lt;/span&gt; static &lt;span class=&quot;kw2&quot;&gt;function&lt;/span&gt; getInstance&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$classInstance&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
            &lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$classInstance&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
        &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$classInstance&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;kw2&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;function&lt;/span&gt; __construct&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;kw2&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;function&lt;/span&gt; getDepartmentLabel&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$id&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; OW&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getLanguage&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'contactus'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;getDepartmentKey&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$id&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;kw2&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;function&lt;/span&gt; addDepartment&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$email&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$label&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
        &lt;span class=&quot;re0&quot;&gt;$contact&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;new&lt;/span&gt; CONTACTUS_BOL_Department&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;re0&quot;&gt;$contact&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;email&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$email&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
        CONTACTUS_BOL_DepartmentDao&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;save&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$contact&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
        BOL_LanguageService&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;addValue&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;
            OW&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getLanguage&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;getCurrentId&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;st_h&quot;&gt;'contactus'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;re0&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;getDepartmentKey&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$contact&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;
            &lt;a href=&quot;http://www.php.net/trim&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;trim&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$label&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;kw2&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;function&lt;/span&gt; deleteDepartment&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$id&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
        &lt;span class=&quot;re0&quot;&gt;$id&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;int&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$id&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$id&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
            &lt;span class=&quot;re0&quot;&gt;$key&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; BOL_LanguageService&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;findKey&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'contactus'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;getDepartmentKey&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$id&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
            BOL_LanguageService&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;deleteKey&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$key&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
            CONTACTUS_BOL_DepartmentDao&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;deleteById&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$id&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;kw2&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;function&lt;/span&gt; getDepartmentKey&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$name&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'dept_'&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt; &lt;a href=&quot;http://www.php.net/trim&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;trim&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$name&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;kw2&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;function&lt;/span&gt; getDepartmentList&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; CONTACTUS_BOL_DepartmentDao&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;findAll&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;/p&gt;

&lt;p&gt;
This class is also a singleton, which allows us to save server resources. The difference between service and DAO is that service calls methods from DAO (not knowing how data is stored) and executes other business logic. There is no business logic in DAO, there are only database queries.
&lt;/p&gt;

&lt;p&gt;
Let&amp;#039;s take a look at &lt;strong&gt;getDepartmentList&lt;/strong&gt; method of &lt;strong&gt;CONTACTUS_BOL_Service&lt;/strong&gt; class. We get instance of &lt;strong&gt;CONTACTUS_BOL_DepartmentDao&lt;/strong&gt; class in this method, and call standard &lt;strong&gt;findAll&lt;/strong&gt; method that returns an array of &lt;strong&gt;CONTACTUS_BOL_Department&lt;/strong&gt; objects.
&lt;/p&gt;

&lt;p&gt;
Now let&amp;#039;s study &lt;strong&gt;addDepartment&lt;/strong&gt; method of the same class, which is a bit more interesting. First we should create &lt;strong&gt;CONTACTUS_BOL_Department&lt;/strong&gt; class object. Then we should set an email value in it, and save the ready object using &lt;strong&gt;save&lt;/strong&gt; method of &lt;strong&gt;CONTACTUS_BOL_DepartmentDao&lt;/strong&gt; class. Now let&amp;#039;s add a label for the new-created department to Languages. This can be done with &lt;strong&gt;addValue&lt;/strong&gt; method of &lt;strong&gt;BOL_LanguageService&lt;/strong&gt; class instance.
&lt;/p&gt;

&lt;p&gt;
In order to create a department table you should add the following code to the end of &lt;strong&gt;install.php&lt;/strong&gt; file:
&lt;/p&gt;

&lt;p&gt;
&lt;pre class=&quot;code php&quot;&gt;&lt;span class=&quot;re0&quot;&gt;$sql&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;CREATE TABLE `&amp;quot;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt; OW_DB_PREFIX &lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;contactus_department` (
    `id` INT(11) NOT NULL AUTO_INCREMENT,
    `email` VARCHAR(200) NOT NULL,
    PRIMARY KEY (`id`)
)
ENGINE=MyISAM
ROW_FORMAT=DEFAULT&amp;quot;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
OW&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getDbo&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$sql&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

&lt;/p&gt;

&lt;p&gt;
&lt;strong&gt;Important&lt;/strong&gt;: Pay attention to &lt;strong&gt;OW_DB_PREFIX&lt;/strong&gt; constant - this is the table prefix you entered during the installation. Always use it when creating or querying tables.
&lt;/p&gt;

&lt;p&gt;
&lt;strong&gt;Important&lt;/strong&gt;: Always name tables according to the following template : &lt;strong&gt;&amp;lt;pluginkey&amp;gt;_&amp;lt;tablename&amp;gt;&lt;/strong&gt; - this will prevent your plugin tables from crossing with other plugin tables.
&lt;/p&gt;

&lt;p&gt;
By calling &lt;strong&gt;OW::getDbo&lt;/strong&gt; we get &lt;strong&gt;OW_Database&lt;/strong&gt; object for working with database which is of lower level than &lt;strong&gt;OW_BaseDao&lt;/strong&gt;. Class &lt;strong&gt;OW_Database&lt;/strong&gt; is a wrapper for &lt;a href=&quot;http://php.net/manual/en/book.pdo.php&quot; class=&quot;urlextern&quot; title=&quot;http://php.net/manual/en/book.pdo.php&quot;  rel=&quot;nofollow&quot;&gt;PDO&lt;/a&gt;. In order to perform a database query we use &lt;strong&gt;query&lt;/strong&gt; method of &lt;strong&gt;OW_Database&lt;/strong&gt; class having passed an sql query as a parameter.
&lt;/p&gt;

&lt;p&gt;
Go to &lt;strong&gt;&amp;lt;domain&amp;gt;/admin/plugins&lt;/strong&gt; page, backup your &lt;a href=&quot;https://wiki.oxwall.com/dev:language-packs&quot; class=&quot;wikilink1&quot; title=&quot;dev:language-packs&quot;&gt;plugin languages&lt;/a&gt; (&lt;strong&gt;important!&lt;/strong&gt;), uninstall, and then reinstall our plugin. After that &lt;strong&gt;contactus_department&lt;/strong&gt; table will be created.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT8 SECTION &quot;Using database&quot; [15810-22417] --&gt;
&lt;h2 class=&quot;sectionedit9&quot; id=&quot;creating-settings-page-in-admin-area&quot;&gt;Creating Settings page in Admin area&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
It&amp;#039;s time to create an admin panel page for managing departments. Create &lt;strong&gt;admin.php&lt;/strong&gt; file in &lt;strong&gt;controllers&lt;/strong&gt; folder of our plugin. Add the controller code to this file:
&lt;/p&gt;

&lt;p&gt;
&lt;pre class=&quot;code php&quot;&gt;&lt;span class=&quot;kw2&quot;&gt;class&lt;/span&gt; CONTACTUS_CTRL_Admin &lt;span class=&quot;kw2&quot;&gt;extends&lt;/span&gt; ADMIN_CTRL_Abstract
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;kw2&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;function&lt;/span&gt; dept&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
        &lt;span class=&quot;re0&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;setPageTitle&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;OW&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getLanguage&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'contactus'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'admin_dept_title'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;re0&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;setPageHeading&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;OW&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getLanguage&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'contactus'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'admin_dept_heading'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;re0&quot;&gt;$contactEmails&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;a href=&quot;http://www.php.net/array&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;re0&quot;&gt;$deleteUrls&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;a href=&quot;http://www.php.net/array&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;re0&quot;&gt;$contacts&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; CONTACTUS_BOL_Service&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;getDepartmentList&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;foreach&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$contacts&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$contact&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
            &lt;span class=&quot;coMULTI&quot;&gt;/* @var $contact CONTACTUS_BOL_Department */&lt;/span&gt;
            &lt;span class=&quot;re0&quot;&gt;$contactEmails&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$contact&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'name'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$contact&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;re0&quot;&gt;$contactEmails&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$contact&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'email'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$contact&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;re0&quot;&gt;$contactEmails&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$contact&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'label'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; CONTACTUS_BOL_Service&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;getDepartmentLabel&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$contact&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;re0&quot;&gt;$deleteUrls&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$contact&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; OW&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getRouter&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;urlFor&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw4&quot;&gt;__CLASS__&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'delete'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;a href=&quot;http://www.php.net/array&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'id'&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$contact&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
        &lt;span class=&quot;re0&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;assign&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'contacts'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$contactEmails&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;re0&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;assign&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'deleteUrls'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$deleteUrls&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
        &lt;span class=&quot;re0&quot;&gt;$form&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;new&lt;/span&gt; Form&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'add_dept'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;re0&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;addForm&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$form&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
        &lt;span class=&quot;re0&quot;&gt;$fieldEmail&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;new&lt;/span&gt; TextField&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'email'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;re0&quot;&gt;$fieldEmail&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;setRequired&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;re0&quot;&gt;$fieldEmail&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;addValidator&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;new&lt;/span&gt; EmailValidator&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;re0&quot;&gt;$fieldEmail&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;setInvitation&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;OW&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getLanguage&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'contactus'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'label_invitation_email'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;re0&quot;&gt;$fieldEmail&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;setHasInvitation&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw4&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;re0&quot;&gt;$form&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;addElement&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$fieldEmail&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
        &lt;span class=&quot;re0&quot;&gt;$fieldLabel&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;new&lt;/span&gt; TextField&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'label'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;re0&quot;&gt;$fieldLabel&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;setRequired&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;re0&quot;&gt;$fieldLabel&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;setInvitation&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;OW&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getLanguage&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'contactus'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'label_invitation_label'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;re0&quot;&gt;$fieldLabel&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;setHasInvitation&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw4&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;re0&quot;&gt;$form&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;addElement&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$fieldLabel&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
        &lt;span class=&quot;re0&quot;&gt;$submit&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;new&lt;/span&gt; Submit&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'add'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;re0&quot;&gt;$submit&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;setValue&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;OW&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getLanguage&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'contactus'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'form_add_dept_submit'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;re0&quot;&gt;$form&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;addElement&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$submit&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
        &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; OW&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getRequest&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;isPost&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
            &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$form&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;isValid&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$_POST&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
            &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
                &lt;span class=&quot;re0&quot;&gt;$data&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$form&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;getValues&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
                CONTACTUS_BOL_Service&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;addDepartment&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$data&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'email'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$data&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'label'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
                &lt;span class=&quot;re0&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;redirect&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;kw2&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;function&lt;/span&gt; delete&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$params&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;a href=&quot;http://www.php.net/isset&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;isset&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$params&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'id'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
            CONTACTUS_BOL_Service&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;deleteDepartment&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;int&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$params&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'id'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
        &lt;span class=&quot;re0&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;redirect&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;OW&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getRouter&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;urlForRoute&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'contactus.admin'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;/p&gt;

&lt;p&gt;
Pay attention to the line in &lt;strong&gt;dept&lt;/strong&gt; method:
&lt;pre class=&quot;code php&quot;&gt;&lt;span class=&quot;re0&quot;&gt;$contacts&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; CONTACTUS_BOL_Service&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;getDepartmentList&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

This line gets us a list of all the available departments. Then we should form the emails array for displaying them as a table.
&lt;/p&gt;

&lt;p&gt;
Pay attention to the line:
&lt;pre class=&quot;code php&quot;&gt;OW&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getRouter&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;urlFor&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw4&quot;&gt;__CLASS__&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'delete'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;a href=&quot;http://www.php.net/array&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'id'&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$contact&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

Using &lt;strong&gt;urlFor&lt;/strong&gt; method of &lt;strong&gt;OW_Router&lt;/strong&gt; class we can generate &lt;abbr title=&quot;Uniform Resource Locator&quot;&gt;URL&lt;/abbr&gt; to &lt;strong&gt;delete&lt;/strong&gt; action of our controller with &lt;strong&gt;GET&lt;/strong&gt; parameter &lt;strong&gt;id&lt;/strong&gt;.
&lt;/p&gt;

&lt;p&gt;
Now let&amp;#039;s create a view for &lt;strong&gt;dept&lt;/strong&gt; action. For that we should create &lt;strong&gt;views/controllers/admin_dept.html&lt;/strong&gt; file with the following content:
&lt;/p&gt;

&lt;p&gt;
&lt;pre class=&quot;code smarty&quot;&gt;&lt;span class=&quot;sc2&quot;&gt;&amp;lt;table class=&amp;quot;ow_table_1 ow_automargin&amp;quot; style=&amp;quot;width: 400px;&amp;quot;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;a href=&quot;http://smarty.php.net/foreach&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;foreach&lt;/span&gt;&lt;/a&gt; &lt;span class=&quot;kw6&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$contacts&lt;/span&gt; &lt;span class=&quot;kw6&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;contact&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
    &lt;span class=&quot;sc2&quot;&gt;&amp;lt;tr class=&amp;quot;{cycle values='ow_alt1,ow_alt2'}&amp;quot;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;sc2&quot;&gt;&amp;lt;td width=&amp;quot;1&amp;quot;&amp;gt;&amp;lt;a href=&amp;quot;{$deleteUrls[$contact.name]}&amp;quot; onclick=&amp;quot;return confirm('{text key=&amp;quot;base+are_you_sure&amp;quot;}');&amp;quot; style=&amp;quot;width:16px; height:16px; display:block; margin:0 auto;background-repeat:no-repeat;background-position: 50% 50%;&amp;quot; class=&amp;quot;ow_ic_delete&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;sc2&quot;&gt;&amp;lt;td&amp;gt;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$contact&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;sc2&quot;&gt;&amp;lt;td&amp;gt;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$contact&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;sc2&quot;&gt;&amp;lt;/tr&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;/&lt;/span&gt;&lt;a href=&quot;http://smarty.php.net/foreach&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;foreach&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&lt;span class=&quot;sc2&quot;&gt;&amp;lt;/table&amp;gt;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;form &lt;span class=&quot;kw6&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;'add_dept'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&lt;span class=&quot;sc2&quot;&gt;&amp;lt;table class=&amp;quot;ow_table_1 ow_form ow_automargin&amp;quot; style=&amp;quot;width: 400px;&amp;quot;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;sc2&quot;&gt;&amp;lt;tr class=&amp;quot;ow_alt1&amp;quot;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;sc2&quot;&gt;&amp;lt;td class=&amp;quot;ow_value&amp;quot;&amp;gt;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;input &lt;span class=&quot;kw6&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;'email'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;sc2&quot;&gt;&amp;lt;td class=&amp;quot;ow_value&amp;quot;&amp;gt;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;input &lt;span class=&quot;kw6&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;'label'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;sc2&quot;&gt;&amp;lt;/tr&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;sc2&quot;&gt;&amp;lt;tr&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;sc2&quot;&gt;&amp;lt;td class=&amp;quot;ow_center&amp;quot; colspan=&amp;quot;2&amp;quot;&amp;gt;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;submit &lt;span class=&quot;kw6&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;'add'&lt;/span&gt; class&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;'ow_button ow_ic_save'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;sc2&quot;&gt;&amp;lt;/tr&amp;gt;&lt;/span&gt;
&lt;span class=&quot;sc2&quot;&gt;&amp;lt;/table&amp;gt;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;/&lt;/span&gt;form&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;/p&gt;

&lt;p&gt;
Pay attention to &lt;strong&gt;{text key=“base+are_you_sure”}&lt;/strong&gt; construction - this is a Smarty function for displaying localized text (synonym for &lt;strong&gt;OW::getLanguage→text&lt;/strong&gt;). We should add prefix and language key separated by “+” symbol to &lt;strong&gt;key&lt;/strong&gt; parameter.
&lt;/p&gt;

&lt;p&gt;
Now our page for departments configuration is available at the following &lt;abbr title=&quot;Uniform Resource Locator&quot;&gt;URL&lt;/abbr&gt;: &lt;strong&gt;&amp;lt;domain&amp;gt;/contactus/admin/dept&lt;/strong&gt;. Having added a couple of departments we will see the following page:
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;https://wiki.oxwall.com/_detail/dev:contact3.png?id=dev%3Abegin%3Acrash-course&quot; class=&quot;media&quot; title=&quot;dev:contact3.png&quot;&gt;&lt;img src=&quot;https://wiki.oxwall.com/_media/dev:contact3.png&quot; class=&quot;media&quot; title=&quot;Department configuration&quot; alt=&quot;Department configuration&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
Data is saved in the database, but are not displayed on the contact form. In order to display them on the contact form get back to &lt;strong&gt;controllers/contact.php&lt;/strong&gt; file and &lt;strong&gt;index&lt;/strong&gt; method. Replace the lines:
&lt;/p&gt;

&lt;p&gt;
&lt;pre class=&quot;code php&quot;&gt;&lt;span class=&quot;re0&quot;&gt;$contactEmails&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;a href=&quot;http://www.php.net/array&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;
    &lt;span class=&quot;st_h&quot;&gt;'admin@site.com'&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'Site administration'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;st_h&quot;&gt;'support@site.com'&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'Technical support'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;st_h&quot;&gt;'billing@site.com'&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'Billing department'&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

&lt;/p&gt;

&lt;p&gt;
with these lines:
&lt;/p&gt;

&lt;p&gt;
&lt;pre class=&quot;code php&quot;&gt;&lt;span class=&quot;re0&quot;&gt;$contactEmails&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;a href=&quot;http://www.php.net/array&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;re0&quot;&gt;$contacts&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; CONTACTUS_BOL_Service&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;getDepartmentList&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kw1&quot;&gt;foreach&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$contacts&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$contact&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span class=&quot;coMULTI&quot;&gt;/* @var $contact CONTACTUS_BOL_Department */&lt;/span&gt;
    &lt;span class=&quot;re0&quot;&gt;$contactEmails&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$contact&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; CONTACTUS_BOL_Service&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;getDepartmentLabel&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$contact&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;/p&gt;

&lt;p&gt;
Our plugin is almost ready. All we need to do is to add the link to the departments configuration page to our plugin settings in the admin panel.
For that you should add the following line to the end of &lt;strong&gt;init.php&lt;/strong&gt; file:
&lt;/p&gt;

&lt;p&gt;
&lt;pre class=&quot;code php&quot;&gt;OW&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getRouter&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;addRoute&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;new&lt;/span&gt; OW_Route&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'contactus.admin'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'admin/plugins/contactus'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;CONTACTUS_CTRL_Admin&amp;quot;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'dept'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

&lt;/p&gt;

&lt;p&gt;
This line has made our page available at the &lt;abbr title=&quot;Uniform Resource Locator&quot;&gt;URL&lt;/abbr&gt;: &lt;strong&gt;&amp;lt;domain&amp;gt;/admin/plugins/contactus&lt;/strong&gt;
&lt;/p&gt;

&lt;p&gt;
Add the line below to the end of &lt;strong&gt;install.php&lt;/strong&gt; file:
&lt;/p&gt;

&lt;p&gt;
&lt;pre class=&quot;code php&quot;&gt;OW&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getPluginManager&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;addPluginSettingsRouteName&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'contactus'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'contactus.admin'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

&lt;/p&gt;

&lt;p&gt;
Uninstall the plugin (again, don&amp;#039;t forget to save your &lt;a href=&quot;https://wiki.oxwall.com/dev:language-packs&quot; class=&quot;wikilink1&quot; title=&quot;dev:language-packs&quot;&gt;language pack&lt;/a&gt;!) and then reinstall it. Now if you go to &lt;strong&gt;&amp;lt;domain&amp;gt;/admin/plugins&lt;/strong&gt; page you will see &amp;#039;Settings&amp;#039; button next to our plugin name.
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;https://wiki.oxwall.com/_detail/dev:contact4.png?id=dev%3Abegin%3Acrash-course&quot; class=&quot;media&quot; title=&quot;dev:contact4.png&quot;&gt;&lt;img src=&quot;https://wiki.oxwall.com/_media/dev:contact4.png&quot; class=&quot;media&quot; title=&quot;Plugin settings&quot; alt=&quot;Plugin settings&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
By clicking this button we get directed to the departments edit page.
&lt;/p&gt;

&lt;p&gt;
&lt;strong&gt;Note&lt;/strong&gt;: if you added tables and languages following the above rules - they will be automatically deleted at uninstallation.
&lt;/p&gt;

&lt;p&gt;
That&amp;#039;s it, our plugin is ready :) You&amp;#039;ve just survived Oxwall plugin development crash course. Go create with us!
&lt;/p&gt;
&lt;hr /&gt;

&lt;p&gt;
&lt;a href=&quot;http://www.oxwall.org/contact&quot; class=&quot;urlextern&quot; title=&quot;http://www.oxwall.org/contact&quot;  rel=&quot;nofollow&quot;&gt;Send feedback&lt;/a&gt; about this article
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT9 SECTION &quot;Creating Settings page in Admin area&quot; [22418-] --&gt;</description>
    </item>
    <item rdf:about="https://wiki.oxwall.com/dev:begin:index">
        <dc:format>text/html</dc:format>
        <dc:date>2012-10-24T11:05:54+00:00</dc:date>
        <title>For Beginners</title>
        <link>https://wiki.oxwall.com/dev:begin:index</link>
        <description>
&lt;h3 class=&quot;sectionedit1&quot; id=&quot;for-beginners&quot;&gt;For Beginners&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;https://wiki.oxwall.com/dev:begin:beginners&quot; class=&quot;wikilink1&quot; title=&quot;dev:begin:beginners&quot;&gt;Getting started with Oxwall development&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;https://wiki.oxwall.com/dev:begin:crash-course&quot; class=&quot;wikilink1&quot; title=&quot;dev:begin:crash-course&quot;&gt;Plugin development crash course&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;https://wiki.oxwall.com/dev:begin:widget&quot; class=&quot;wikilink1&quot; title=&quot;dev:begin:widget&quot;&gt;The widget concept&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
</description>
    </item>
    <item rdf:about="https://wiki.oxwall.com/dev:begin:widget">
        <dc:format>text/html</dc:format>
        <dc:date>2012-10-24T11:06:06+00:00</dc:date>
        <title>What is a widget?</title>
        <link>https://wiki.oxwall.com/dev:begin:widget</link>
        <description>
&lt;h1 class=&quot;sectionedit1&quot; id=&quot;what-is-a-widget&quot;&gt;What is a widget?&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
&lt;strong&gt;Widget&lt;/strong&gt; is a component that can be added to the widget panel ( index page, dashboard, profile page, etc. ). &lt;strong&gt;Widget&lt;/strong&gt; is a child of the &lt;strong&gt;BASE_CLASS_Widget&lt;/strong&gt; class, which in its turn is a child class of &lt;strong&gt;OW_Component&lt;/strong&gt;. 
&lt;/p&gt;

&lt;p&gt;
Thus, widget is a standard component with additional functionality. 
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT1 SECTION &quot;What is a widget?&quot; [1-330] --&gt;
&lt;h1 class=&quot;sectionedit2&quot; id=&quot;widget-creation&quot;&gt;Widget creation&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
We will use the standard Custom Html widget as an example.
&lt;/p&gt;

&lt;p&gt;
Class
&lt;pre class=&quot;code php&quot;&gt;&lt;span class=&quot;kw2&quot;&gt;class&lt;/span&gt; BASE_CMP_CustomHtmlWidget &lt;span class=&quot;kw2&quot;&gt;extends&lt;/span&gt; BASE_CLASS_Widget
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span class=&quot;kw2&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$content&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kw2&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$nl2br&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;kw2&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;function&lt;/span&gt; __construct&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; BASE_CLASS_WidgetParameter &lt;span class=&quot;re0&quot;&gt;$paramObject&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
        parent&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;__construct&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
        &lt;span class=&quot;re0&quot;&gt;$params&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$paramObject&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;customParamList&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
        &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;!&lt;/span&gt;&lt;a href=&quot;http://www.php.net/empty&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;empty&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$params&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'content'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
            &lt;span class=&quot;re0&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;content&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$paramObject&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;customizeMode&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;!&lt;/span&gt;&lt;a href=&quot;http://www.php.net/empty&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;empty&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$_GET&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'disable-js'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; ? UTIL_HtmlTag&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;stripJs&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$params&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'content'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$params&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'content'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
        &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;a href=&quot;http://www.php.net/isset&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;isset&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$params&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'nl_to_br'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
            &lt;span class=&quot;re0&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;a href=&quot;http://www.php.net/nl2br&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;nl2br&lt;/span&gt;&lt;/a&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bool&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$params&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'nl_to_br'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;kw2&quot;&gt;public&lt;/span&gt; static &lt;span class=&quot;kw2&quot;&gt;function&lt;/span&gt; getSettingList&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// If you redefine this method, you'll be able to add fields to the widget configuration form &lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
        &lt;span class=&quot;re0&quot;&gt;$settingList&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;a href=&quot;http://www.php.net/array&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;re0&quot;&gt;$settingList&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'content'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;a href=&quot;http://www.php.net/array&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;
            &lt;span class=&quot;st_h&quot;&gt;'presentation'&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;PRESENTATION_TEXTAREA&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// Field type&lt;/span&gt;
            &lt;span class=&quot;st_h&quot;&gt;'label'&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&amp;gt;&lt;/span&gt; OW&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getLanguage&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'base'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'custom_html_widget_content_label'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// Field name&lt;/span&gt;
            &lt;span class=&quot;st_h&quot;&gt;'value'&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;''&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// Default value&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
        &lt;span class=&quot;re0&quot;&gt;$settingList&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'nl_to_br'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;a href=&quot;http://www.php.net/array&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;
            &lt;span class=&quot;st_h&quot;&gt;'presentation'&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;PRESENTATION_CHECKBOX&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;st_h&quot;&gt;'label'&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&amp;gt;&lt;/span&gt; OW&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getLanguage&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'base'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'custom_html_widget_nl2br_label'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;st_h&quot;&gt;'value'&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'0'&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
        &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$settingList&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;kw2&quot;&gt;public&lt;/span&gt; static &lt;span class=&quot;kw2&quot;&gt;function&lt;/span&gt; processSettingList&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$settings&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$place&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// This method is called before saving the widget settings. Here you can process the settings entered by a user before saving them. &lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$place&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;!=&lt;/span&gt; BOL_ComponentService&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;PLACE_DASHBOARD&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;!&lt;/span&gt;OW&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getUser&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;isAdmin&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
            &lt;span class=&quot;re0&quot;&gt;$settings&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'content'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; UTIL_HtmlTag&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;stripJs&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$settings&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'content'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;re0&quot;&gt;$settings&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'content'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; UTIL_HtmlTag&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;stripTags&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$settings&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'content'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;a href=&quot;http://www.php.net/array&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'frame'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;a href=&quot;http://www.php.net/array&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;else&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
            &lt;span class=&quot;re0&quot;&gt;$settings&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'content'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; UTIL_HtmlTag&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;sanitize&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$settings&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'content'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
        &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$settings&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;kw2&quot;&gt;public&lt;/span&gt; static &lt;span class=&quot;kw2&quot;&gt;function&lt;/span&gt; getStandardSettingValueList&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// If you redefine this method, you will be able to set default values for the standard widget settings. &lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;a href=&quot;http://www.php.net/array&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;
            &lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;SETTING_TITLE&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&amp;gt;&lt;/span&gt; OW&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getLanguage&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'base'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;'custom_html_widget_default_title'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// Set the widget title &lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;kw2&quot;&gt;public&lt;/span&gt; static &lt;span class=&quot;kw2&quot;&gt;function&lt;/span&gt; getAccess&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// If you redefine this method, you'll be able to manage the widget visibility &lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;ACCESS_ALL&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;kw2&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;function&lt;/span&gt; onBeforeRender&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// The standard method of the component that is called before rendering&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
        &lt;span class=&quot;re0&quot;&gt;$content&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;a href=&quot;http://www.php.net/nl2br&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;nl2br&lt;/span&gt;&lt;/a&gt; ? &lt;a href=&quot;http://www.php.net/nl2br&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;nl2br&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;content&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;re0&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;assign&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'content'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$content&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;/p&gt;

&lt;p&gt;
Each widget&amp;#039;s constructor has one parameter - the object of BASE_CLASS_WidgetParameter class&lt;br/&gt;

&lt;/p&gt;

&lt;p&gt;
&lt;strong&gt;BASE_CLASS_WidgetParameter&lt;/strong&gt; has the following fields&lt;br/&gt;

- &lt;strong&gt;$customParamList&lt;/strong&gt; - is the associative array of the settings&amp;#039; fields values added by a user&lt;br/&gt;

- &lt;strong&gt;$additionalParamList&lt;/strong&gt; - is the associative array of the additional parameters. For example, user ID can be taken from this array (if the widget is placed to the profile page).&lt;br/&gt;

Array element &lt;strong&gt;entityId&lt;/strong&gt; - is user Id&lt;br/&gt;

- &lt;strong&gt;$standartParamLiqt&lt;/strong&gt; - is the object of WidgetStandartParamList class. You can get the values of the standard widget settings from this object.&lt;br/&gt;

- &lt;strong&gt;$customizeMode&lt;/strong&gt; - this field contains boolean value.&lt;br/&gt;

- &lt;strong&gt;$widgetDetails&lt;/strong&gt; - is the object of WidgetDetails class. It contains information on a certain widget sample. Currently it consists of only one field - &lt;strong&gt;$uniqName&lt;/strong&gt; - unique widget name&lt;br/&gt;

&lt;/p&gt;

&lt;p&gt;
The widget functionality can be managed by redefining the following methods of the parent class&lt;br/&gt;

- &lt;strong&gt;getSettingList&lt;/strong&gt; - if this method is redefined, you will be able to add fields to the widget configuration form&lt;br/&gt;

- &lt;strong&gt;processSettingList&lt;/strong&gt; - this method is called before saving the widget settings. Here you can process the settings entered by a user before saving them.&lt;br/&gt;

- &lt;strong&gt;getStandardSettingValueList&lt;/strong&gt; - if this method is redefined, you will be able to set default values for the standard widget settings&lt;br/&gt;

- &lt;strong&gt;getAccess&lt;/strong&gt; - if this method is redefined, you will be able to manage the widget visibility &lt;br/&gt;

- &lt;strong&gt;validateSettingList&lt;/strong&gt; - redefining this method will make it possible to check the data entered by a user in the widget configuration form. Throwing WidgetSettingValidateException type exception into this method will prevent settings from being saved. You should pass the message and the name of the form&amp;#039;s field whose value failed the check to the exception constructor&lt;br/&gt;

&lt;/p&gt;

&lt;p&gt;
In other aspects, a widget&amp;#039;s behavior is no different from a standard component&amp;#039;s behavior&lt;br/&gt;

&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT2 SECTION &quot;Widget creation&quot; [331-5175] --&gt;
&lt;h1 class=&quot;sectionedit3&quot; id=&quot;adding-a-widget&quot;&gt;Adding a widget&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
Once you&amp;#039;ve created a widget, you should add it to the widgets page&lt;br/&gt;

Here is an example of adding a Custom Html widget to the Dashboard page&lt;br/&gt;

&lt;pre class=&quot;code php&quot;&gt;&lt;span class=&quot;re0&quot;&gt;$widgetService&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; BOL_ComponentAdminService&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;re0&quot;&gt;$widget&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$widgetService&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;addWidget&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'BASE_CMP_CustomHtml'&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// Register the widget. The first parameter is the name of the widget class. The second parameter stands for whether the widget can be cloned, or may have only one sample on the page\\&lt;/span&gt;
&lt;span class=&quot;re0&quot;&gt;$widgetPlace&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$widgetService&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;addWidgetToPlace&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$widget&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; BOL_ComponentService&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;PLACE_DASHBOARD&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// Add the widget to the page&lt;/span&gt;
&lt;span class=&quot;re0&quot;&gt;$widgetService&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;addWidgetToPosition&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$widgetPlace&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; BOL_ComponentService&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;SECTION_LEFT&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// Choose a special position on the page to add the widget. the third parameter of this function is the widget's position in a certain section. If you want to add the widget to the very bottom, you should set -1. &lt;/span&gt;&lt;/pre&gt;

&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT3 SECTION &quot;Adding a widget&quot; [5176-6112] --&gt;
&lt;h1 class=&quot;sectionedit4&quot; id=&quot;deleting-a-widget&quot;&gt;Deleting a widget&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
The widget can be deleted the following way&lt;br/&gt;

&lt;pre class=&quot;code php&quot;&gt;BOL_ComponentAdminService&lt;span class=&quot;sy0&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;deleteWidget&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;'BASE_CMP_CustomHtml'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// remove the widget and all its samples from all pages &lt;/span&gt;&lt;/pre&gt;

&lt;/p&gt;

&lt;p&gt;
Usually, a plugin activation adds a widget. Deactivating a plugin removes a widget.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT4 SECTION &quot;Deleting a widget&quot; [6113-] --&gt;</description>
    </item>
</rdf:RDF>
