section_panel_title()

Last Updated:
Back to Main Index

section_panel_title() is one of 5 default helper functions defined in the Layers_Form_Elements class used specifically for defining the title and excerpt or header section of a form or widget.

Location: /core/helpers/forms.php

Usage:

A basic example of a form input being generated follows. Here we are instantiating the form elements class then calling up the section title with the section_panel_title() function

It’s important to note that this function should be used in conjuction with the <div class="<a href="https://github.com/Obox/layerswp/blob/master/core/assets/admin.css#L298" target="_blank">layers-panel</a>"> wrapper followed by the <div class="<a href="https://github.com/Obox/layerswp/blob/master/core/assets/admin.css#L266" target="_blank">layers-content</a>"> wrapper around your form elements.

To instantiate the class, use the following syntax $this->form_elements()->section_panel_title( /* Args */ );

If you are inside a Layers Builder Widget, there is no need to instantiate the class, as it is already included in each builder widget.

Parameters

This function accepts an array with the following arguments:

  • typepanel or control depending on the CSS that needs to be generated.
  • title – Title of your panel.

The above will output the following HTML:

A good example of this function being used is in the Layers Contact Widget.