Developer Guide / April 4, 2017

Field System - Configuration Array

The Field System Array is designed to store field related information, the information will be used in various objects under different circumstances. Like for example the translation key will be used as the array key map when integrating field dynamic strings to WPML plugin for translation.

  /**
     * Example of valid property fields registration
     * array, you can inject this array via field related hooks
     */
    $registry['property_duration'] = array(
      'field' => 'property_duration',
      'name' => __('Duration', 'victheme_property'),
      'label' => __('Availability', 'victheme_property'),
      'enabled' => true,
      'icons' => array(
        'icon' => 'real8',
        'family' => 'proicon',
      ),
      'settings' => array(
        'separator' => array(
          'mode' => 'data',
          'type' => 'VTCore_Bootstrap_Form_BsText',
          'context' => array(
            'text' => __('Separator', 'victheme_property'),
            'description' => __('Configure the text for the separator element', 'victheme_property'),
            'value' => __('To', 'victheme_property'),
          ),
        ),
        'format' => array(
          'mode' => 'data',
          'type' => 'VTCore_Bootstrap_Form_BsText',
          'context' => array(
            'text' => __('Date Format', 'victheme_property'),
            'description' => __('Configure the text for the separator element', 'victheme_property'),
            'value' => 'd/m/Y',
          ),
        ),
      ),
      'storage' => array(
        'from' => array(
          'type' => 'meta',
          'mode' => 'timestamp',
          'target' => '_property_duration_from',
        ),
        'end' => array(
          'type' => 'meta',
          'mode' => 'timestamp',
          'target' => '_property_duration_end',
        ),
      ),
      'translation' => array(
        'search.label',
        'search.settings.from.context.value',
        'search.settings.separator.context.value',
        'search.settings.end.context.value',
        'settings.separator.context.value',
        'metabox.settings.from.context.value',
        'metabox.settings.end.context.value',
      ),
      'search' => array(
        'label' => __('Availability', 'victheme_property'),
        'settings' => array(
          'from' => array(
            'type' => 'VTCore_Bootstrap_Form_BsText',
            'context' => array(
              'text' => __('From Date Form Label', 'victheme_property'),
              'description' => __('Configure the text for the from date search form label text', 'victheme_property'),
              'value' => __('Availability Start Date', 'victheme_property'),
            ),
          ),
          'separator' => array(
            'type' => 'VTCore_Bootstrap_Form_BsText',
            'context' => array(
              'text' => __('Separator Date Form Label', 'victheme_property'),
              'description' => __('Configure the text for the separator search form label text', 'victheme_property'),
              'value' => __('to', 'victheme_property'),
            ),
          ),
          'end' => array(
            'type' => 'VTCore_Bootstrap_Form_BsText',
            'context' => array(
              'text' => __('End Date Form Label', 'victheme_property'),
              'description' => __('Configure the text for the end date search form label text', 'victheme_property'),
              'value' => __('Availability End Date', 'victheme_property'),
            ),
          ),
        ),
      ),
      'metabox' => array(
        'label' => __('Duration', 'victheme_property'),
        'description' => __('Set the availability duration for this property.', 'victheme_property'),
        'settings' => array(
          'from' => array(
            'type' => 'VTCore_Bootstrap_Form_BsText',
            'context' => array(
              'text' => __('From Form Label', 'victheme_property'),
              'description' => __('Configure the text for the from form label text', 'victheme_property'),
              'value' => __('From Date', 'victheme_property'),
            ),
          ),
          'end' => array(
            'type' => 'VTCore_Bootstrap_Form_BsText',
            'context' => array(
              'text' => __('End Form Label', 'victheme_property'),
              'description' => __('Configure the text for the end form label text', 'victheme_property'),
              'value' => __('End Date', 'victheme_property'),
            ),
          ),
        ),
      ),
      'objects' => array(
        'metabox' => 'VTCore_Property_Form_Metabox_Duration',
        'search' => 'VTCore_Property_Form_Search_Duration',
        'display'=> 'VTCore_Property_Element_Duration',
      ),
      'visibility' => array(
        'from' => true,
        'separator' => true,
        'end' => true,
        'label' => true,
        'icon' => true,
        'search' => true,
      ),
      'group' => 'property_info',
      'weight' => 1,
    );

 

field

The field key is the field machine name, this field string entry must be unique



name

This field key is for storing the field human readable name, this is most likely to be used for the front end field label or as a fallback if the field doesn’t have any special labeling for search, metabox and front end display.



enabled

This field is for turning on / off a field instantly.



label

The string text for the field form label element, this will be served as the default fallback value if the field hasn’t defined string for metabox and search form label field.



icons

The icon array context for VTCore_Wordpress_Element_WpIcon object. By using the VTCore icon objects you can access all the icons defined via VTCore Icon Factory and if any theme or plugin register additional icon set to the library, it will also available for field to use.



settings

It is possible to define custom settings context that will be used when creating the field management form, this way you can always create a field that can be customized via WordPress backend easily.



storage

Define the field data storage behavior, you can have multiple storage point in a single field. Valid storage types are taxonomy terms, metadata and data (serialized data in a single _property_data post meta.



translation

Define the array key in dotted notation format referencing the field array context for marking that the array value defined in the defined array key will be passed through WPML hooks for registering it as a custom strings ready for translation.



translation

Define the array key in dotted notation format referencing the field array context for marking that the array value defined in the defined array key will be passed through WPML hooks for registering it as a custom strings ready for translation.



search

The search branch in the array context is for mapping context that will be passed to the field configuration GUI and the field form when in search mode.



visibility

Define what should be displayed globally, this will be used when building field front end display, search form and metabox form.



objects

Define the PHP class name that will be used when building the front end display, search form field and metabox form field. The property entity responsible for building the object will assume that the class name is either already loaded or eligible for autoloading. if it isn’t available due to any reasons the field will not build the output for field mode.



group

This is used mainly in metabox mode only, the purpose is to determine on which accordion group that the related plugin should be inserted to.



weight

The weight for ordering the field when rendered

 

Related Product

WordPress Property Real Estate Plugin

VT Property is a WordPress plugin for Real estate and Properties sites. You can have unlimited attributes for the properties and create multiple agents as user. Available Features Ajax search form Custom property icon Different property attributes Different property types Visual composer ready Property marker within maps Custom marker upload...
View Product

Related Documentation

Entity System - Property Factory

Entity System - Property Factory

What is Property Entity Factory? Property entity factory is the PHP class wrapper for building a property entity object based on data from a property post data. The class will build all relevant type entity, field entities and attribute entities related to a single post entry. I...
Creating agents listing template

Creating agents listing template

If there is no valid agents listing page then the plugin will use author.php template which will display all author posts instead of listing of agents. Therefore it is strongly suggested to create a custom agents listing template in your theme. Step One – Locate theme...
Field System - Display Object

Field System - Display Object

/** * Class for building the field status * * @author jason.xie@victheme.com * */ class VTCore_Property_Element_Status extends VTCore_Property_Models_Element { /** * Define the default context array * The context will be merged with user supplied context ...
Creating property archive template

Creating property archive template

It is recommended to create a separate archive template for property rather than using theme default archive.php or index.php. Step One – Locate theme file You will need to locate theme archive.php or index.php which usually located in the root folder of your theme. Step...
Entity System - Property Type

Entity System - Property Type

What is Type Entity? Type entity is a PHP class for managing property type entity Create Revise Update and Delete process. The purpose of this class is to act as the general gateway object for other to use. What is property type? Property type is actually a Taxonomy with Terms t...
Field System - Search Query Vars

Field System - Search Query Vars

When a custom property field is marked as allowed for searching there are couple of extra steps needed to register the query variables so it will be eligible when WP_Query is processing the actual query. Step One – Register the searched variable key When Building the Prope...
Creating property single template

Creating property single template

It is recommended to create a separate single page template for property rather than using theme default page.php or single.php or index.php. Step One – Locate theme file You will need to locate theme page.php or single.php or index.php which usually located in the root f...
Entity System - Property Field

Entity System - Property Field

What is Field Entity? Field entity is a PHP class for wrapping all operations such as creating, updating and disabling the property field system. It is recommended to use the class object when trying to manipulate the field system as many logic and hooks is will be invoked inside...
Field System - Field Hooks

Field System - Field Hooks

Property plugin Fields System is alterable via hooks : Hook Filter – vtcore_property_alter_fields This filter allows you to modify, remove or add fields into the field registration, It will be fired when VTCore_Property_Fields object is created Hook Action – vtcore_...
Field System - Search Object

Field System - Search Object

When a registered field is called via Property Factory to build its markup for search field display purposes, the field system will search for the entry value of objects.search in the field configuration array and when found, the entry value will be treated as the class name...
Entity System - Property Attributes

Entity System - Property Attributes

What is Attributes Entity? Attributes entity object is a PHP class for managing the Property Attributes entry to a property type. It is recommended to use this class when need to alter a Property Attributes programatically only. What is property attributes? Property Attributes i...
Creating agents profile template

Creating agents profile template

If there is no valid agents profile page then the plugin will use author.php template which will display all author posts instead the agents profile page. Therefore you must create a custom agents profile template to display the author profile information. Step One – ...
Overriding Plugin Templates

Overriding Plugin Templates

You can override all templates found in victheme_property/templates folder by creating an new folder with this structure templates/property/ in the root of your theme. Then copy the templates files that you want to override from victheme_property/templates folder into the newly ...
Overriding plugin assets

Overriding plugin assets

You can override any of the VicTheme Property or VicTheme Agents or VicTheme Core plugins default CSS and Javascript assets by registering a new assets to replace the old assets. For example, to override the property-front.css which is bundled inside the property-front assets yo...
Video Documentation

Video Documentation

How To Create Agents How to create property attributes How to create and manage property type How to configure teaser element How to add video on property pag...