March 2017... Soon the joomla 3.7 version and its set of new features. The same for AllEvents

A new feature especially out question to me: The custom fields. I remember the number of hours that I needed to develop them in AllEvents one year ago and the single hour (yes, less than 60 minutes) to integrate this new feature in AllEvents. Developers friends, I am going to say you how I just did afterwards. 

In the set of news in the 3.4.7 it's mainly the introduction of plugins that makes that anybody is able to develop its own event displays, event forms, list of events. It's the end of the overrides. All is performed thru plugin: you develop it, you install itr and you maintain the display. We can also add bugs corrections, the field of thumbnail and poster fulfilling in frontend, the editor correction in the frontend, a "webinar like" new event display mode .

Come back to this Joomla 3.7 new feature

Custom fields

Custom fields are one out of the new Joomla 3.7 features. Natively, you will be able to add sutyom fields to articles, user profiles and contact form. With its integration in AllEvents you will be able to do the same thing in your events.

If you are an AllEvents user, that's all for you. But, if you are a developer, the next part should interest you.


As any componentr, AllEvents is based on a MVC model. So, I consider that your component is compliant with this model. 

Theorically, you should have an attribs column or params in your table. That allows to store metadata for example... So, I consider you have it.

Step 1 : You have to define the display in your menu on the left. Your componet becomes a context (in our case: com_allevents.event) of the com_fields component of Joomla.

It's located in /administrator/helpers/allevents.php

We add these few lines:

if (JComponentHelper::isEnabled('com_fields'))
        $vName == 'fields.fields'
        $vName == 'fields.groups'


I have defined two entries: one for the fields, another one fro the groups. You immediately checkj the result by depositing this file int right location.

Step 2: modify the event.xml manifest file to display the custom fields in the screen of event fulfill

This is located in the /administrator/models/forms/event.xml file

<fieldset name="display" label="JGLOBAL_FIELDSET_DISPLAY_OPTIONS" addfieldpath="/administrator/components/com_fields/models/fields">
    <field name="show_user_custom_fields" type="fieldgroups" multiple="true" context="com_allevents.event" label="COM_ALLEVENTS_FIELD_USER_CUSTOM_FIELDS_SHOW_LABEL" description="COM_ALLEVENTS_FIELD_USER_CUSTOM_FIELDS_SHOW_DESC">
        <option value="-1">JALL</option>

Step 3: In the frontend get back the fulfilled values of your element

This is located in the /models/event.php file. The fields are got back in fields. In the AllEvents use cas, the used columns is params.

if (!isset($this->_item->fields)){ $this->_item->fields = [] ; }
if (class_exists('FieldsHelper'))
    // Convert parameter fields to objects.
    $this->_item->params = new Registry($this->_item->params);
    $this->_item->params = $this->_item->params->toArray();
    $this->_item->fields = FieldsHelper::getFields('com_allevents.event', $this->_item, true, $this->_item->params) ; 

Step 4:In the frontend get back the fulefilled values of element

This is located in the /views/event/tmpl/event.php file. A small piece of code got back in the contact display:

$eventFieldGroups = array();

foreach ($item->fields as $field) :
    if ((!$field->group_id )) : 
    if (!key_exists($field->group_title, $eventFieldGroups)) : 
        $eventFieldGroups[$field->group_title] = array(); 
    $eventFieldGroups[$field->group_title][] = $field; 
<?php foreach ($eventFieldGroups as $groupTitle => $fields) : ?>
<?php $id = JApplicationHelper::stringURLSafe($groupTitle); ?>
<?php echo '<h3>' . ($groupTitle ?: JText::_('COM_ALLEVENTS_EVENT_FIELDS')) . '</h3>'; ?>

<div class="contact-profile" id="user-custom-fields-<?php echo $id; ?>">
<dl class="dl-horizontal"> 
<?php foreach ($fields as $field) : ?>

<?php if (!$field->value) : ?>
<?php continue; ?>
<?php endif; ?>

<?php echo '<dt>' . $field->label . '</dt>'; ?>
<?php echo '<dd>' . $field->value . '</dd>'; ?>
<?php endforeach; ?>
<?php endforeach; ?>

Step 5 : There is not... That's all for AllEvents

As you have seen it, by modifying 4 AllEvents files, we are able to propose custom fields to our users.

Some thing remain to do like:

  • The distinction of the groups of field: distinguish the fiels related to the events and the ones related to the registreations
  • The evntual translations of the tag in the backend

If you have any questions or feedback abou this article, you can easily join me.