Advance

Already mastered Komento? Here, you will learn a much more advanced settings. Become Komento's power-user!

Component's Plugin

Creating your own Komento integration is fairly simple. You have to be familiar with PHP and of course the component that you'd like to integrate with.

Let's start creating your first Komento component's plugin. By default, Komento will looks for the component's plugins at /components/com_komento/komento_plugins/. In this folder, you will find all the Komento component's plugins.

Creating New Komento Component's Plugin File

Create your own Komento component's plugins in this folder (defined above). Your component's plugins must be named as the same as the component's name for future reference. As example, you have created a Komento component plugin named com_egg as illustrated in the screenshot below.

Komento Component's Plugin File

Class Definition

After you have created the plugin as explained above, you may now start writing your codes. Make sure the class name should always begin with Komento. For instance, Komento must be prepend before your component's name on the class definition: class KomentoComegg.

Constructor Method

If your component requires an extra file, you may load it on the constructor method.

Make sure to call parent::__construct($component) at the end of constructor method.

Mandatory Methods

This plugin's class must contains all the following methods. These methods are the Komento core functions required to get all the necessary data.

Function load is essential to Komento in order to load single article to $_item.

Function getContentIds usually used to retrieve all article ids for the specified categories.

Function getCategories is quite an important method in retrieving categories in your component. You need to know whether your component has a single level categories or nested categories which most of Joomla component do have. You have to code this method accordingly.

Function isListingView is a method in which determine whether Komento comment form should not be rendered on this view.

Function isEntryView is the opposite of the above. This method determine whether Komento comment form should be displayed on this view.

Function onExecute is the main method that appends Komento on the article. This method outputs the HTML code upon execution. You may also use it to append code to an article object.

Optional Methods

These methods are optional. For some cases, you might need these methods to further manipulate the integration between Komento and your component.

Trigger methods

These are advanced methods where you can use them to further extend Komento's feature or usability. Refer to the Trigger documentation for more information.

Implementation

After you have the integration abstract layer ready and properly in place, you can now call Komento in your template file; on comment section. This to render Komento form.

This method commentify() expects an article object which generated by your component consisting all the necessary properties. It return a html form of Komento to be displayed on the site.

  1. id or $_map['id'] - Article ID (This should follow the class method of _map that contains the mapping to the 'id' name).
  2. catid - Category ID that the article belongs to.
  3. introtext - Introtext of the content (typically content before the "Read More" break).
  4. text - Full content of the article.

Sample Class Com_sample