header()
Back to Main Index
header() 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
Parameters
The header function accepts one parameter as an array, the function then decodes the array as needed.
Default arguments are:
- title – Title to be displayed in this header
- icon_class – Icon class to use, which will be prefixed with ‘icon-‘
Usage
This function is used to output a uniform widget header.
1 2 3 4 5 6 7 8 |
<?php $form_elements = new Layers_Form_Elements(); echo $form_elements->header( array( 'title' => __( 'Widget' , 'layerswp' ), 'icon_class' => 'post' ) ); ?> |
Or see how it is used within the form() function of a builder widget
The above will output the following HTML:
1 2 3 4 |
<h2 class="layers-heading layers-icon layers-icon-post"> <i class="icon-post-small"></i> Post </h2> |
See Developer Tutorials: Layers Builder Widgets for a detailed overview of using these class helpers in widget building.
Similar to:
$form_elements->header()