1. Home
  2. Docs
  3. For Developer
  4. Extend AZP

Extend AZP

I. Add element

To create new elements for AZP builder you have to hook into azp_register_elements filter with AZP core elements array and return your new elements array. You can place the code in child theme or other plugin.

You can add new element by add new item to the $new_elements array with key is your element type (contains only a-zA-Z0-9 and _ characters. Example: azp_shortcode ). And new item value is an array contains its cofiguration values).

II. Element parameters

This is a list of element parameters:

  1. name (string): name of the element
  2. desc (string): element description text
  3. category (string): this text will be used in filter tab on elements selector window. Default: content, structure, social. You can also add your new one.
  4. open_settings_on_create (bool): whether to show element settings window after element is added to page or nor.
  5. showStyleTab (bool): show Style settings tab or not
  6. showTypographyTab (bool): show Typography settings tab or not
  7. showAnimationTab (bool): show Animation settings tab or not
  8. icon (string): element icon url
  9. template_path (string): absolute path of template file which will use to output the element content. Note: You can omit this param, then the builder will looking in azp_templates folder on your theme for template file.
  10. attrs (array): is an array contains arrays of element attributes.

When done your new element will appear in elements selector and element settings window like screenshots bellow:

III. Element template

Is this so easy? Yes, it’s incredible easy.

Now the left thing is create a .php file which will output the element content. In the code above we do not declare template_path value so /azp_templates/azp_shortcode.php file in your current theme folder will be used.

When the template file is load by AZP, $azp_attrs$azp_content and $azp_element variables are passed to the file.

  1. $azp_attrs (array): is a key/value pair array for element settings ( from attrs array when you define the element ) with key is param_name value. In the template file we will extract it as element parameter variables.
  2. $azp_content (string): contains content value for the element. Which is value of field with “param_name”=>”content” and “iscontent”=>”yes”
  3. $azp_element (string): is element type (key in the $elements variable – azp_shortcode for this element ).

That’s all you need to create new element for AZP builder. We think it’s the simplest, easiest and fastest way.

Was this article helpful to you? Yes No 1

How can we help?