APIs on enqueue and libraries

Hook: ipt_fsqm_form_elements_front_enqueue

Triggered when the form enqueues its needed scripts and styles.

Hook Uses

Passes one argument, a reference to the IPT_FSQM_Form_Elements_Front object.

/**
 * Enqueue our own script during eForm frontend enqueue
 *
 * @param      object  $obj    Reference to IPT_FSQM_Form_Elements_Front object
 */
function fsqm_front_enqueue( $obj ) {
	// Do something in the enqueue event
	// Perhaps get your own CSS or JS
	wp_enqueue_script( 'myscript', plugins_url( '/js/myscript,js', __FILE__ ), array( 'jquery' ), '1.0.0' );
	wp_enqueue_style( 'mycss', plugins_url( '/css/mycss.css', __FILE__ ), array(), '1.0.0' );
}
add_action( 'ipt_fsqm_form_elements_front_enqueue', 'fsqm_front_enqueue', 10, 1 );

Source

Located in classes/class-ipt-fsqm-form-elements-front.php.

Hook: ipt_fsqm_form_elements_up_enqueue

Triggers for User Portal scripts and styles enqueue.

Hook Uses

/**
 * Enqueue our own script during eForm frontend user portal
 *
 */
function fsqm_up_enqueue() {
	// Do something in the enqueue event
	// Perhaps get your own CSS or JS
	wp_enqueue_script( 'myscript', plugins_url( '/js/myscript,js', __FILE__ ), array( 'jquery' ), '1.0.0' );
	wp_enqueue_style( 'mycss', plugins_url( '/css/mycss.css', __FILE__ ), array(), '1.0.0' );
}
add_action( 'ipt_fsqm_form_elements_up_enqueue', 'fsqm_up_enqueue', 10, 0 );

Source

Located in classes/class-ipt-fsqm-form-elements-static.php.

Hook: ipt_fsqm_report_enqueue

Triggers for Report and Analysis enqueue.

Hook Uses

/**
 * Enqueue our own script during eForm reports
 *
 * @param      object  $obj    Reference to IPT_FSQM_Form_Elements_Utilities object
 */
function fsqm_report_enqueue( $obj ) {
	// Do something in the enqueue event
	// Perhaps get your own CSS or JS
	wp_enqueue_script( 'myscript', plugins_url( '/js/myscript,js', __FILE__ ), array( 'jquery' ), '1.0.0' );
	wp_enqueue_style( 'mycss', plugins_url( '/css/mycss.css', __FILE__ ), array(), '1.0.0' );
}
add_action( 'ipt_fsqm_report_enqueue', 'fsqm_report_enqueue', 10, 1 );

Example

Source

Located in classes/class-ipt-fsqm-form-elements-utilities.php.

Hook: ipt_plugin_ui_enqueue

Triggers during the enqueue for different form elements (both admin side and front side).

Hook Uses

/**
 * Enqueue our own script during basic UI call
 *
 * @param      object  $obj    Reference to IPT_Plugin_UIF_Base object
 */
function fsqm_uib_enqueue( $obj ) {
	// Do something in the enqueue event
	// Perhaps get your own CSS or JS
	wp_enqueue_script( 'myscript', plugins_url( '/js/myscript,js', __FILE__ ), array( 'jquery' ), '1.0.0' );
	wp_enqueue_style( 'mycss', plugins_url( '/css/mycss.css', __FILE__ ), array(), '1.0.0' );
}
add_action( 'ipt_plugin_ui_enqueue', 'fsqm_uib_enqueue', 10, 1 );

Source

Located in lib/classes/class-ipt-plugin-uif-base.php.

Filter: ipt_fsqm_report_js

Filters the localization object of the report js. Apart from localization, it also provides ways for adding JS callback for custom form elements.

Filter Uses

/**
 * Add JS callbacks for calculations and chart rendering
 * for our custom added element
 *
 * @param      array  $settings  Associative array of settings
 *
 * @return     array
 */
function fsqm_custom_reports( $settings ) {
	// Let us add our own JS callback functions
	// So that our report would work on the newly added elements
	$settings['callbacks']['myelem'] = 'myjsfunc';
	$settings['gcallbacks']['myelem'] = 'myjsfunccharts';
	return $settings;
}
add_filter( 'ipt_fsqm_report_js', 'fsqm_custom_reports', 10, 1 );

Example

Source

Located in classes/class-ipt-fsqm-form-elements-utilities.php.

Filter: ipt_fsqm_filter_utilities_report_print

Provides way to modify action buttons after a Report (Trends).

Filter Uses

/**
 * Adds a download button to the report output
 *
 * @param      array   $buttons  Associative array of buttons
 * @param      object  $obj      A reference to IPT_FSQM_Form_Elements_Utilities object
 * @return     array
 */
function fsqm_report_custom_button( $buttons, $obj ) {
	// Let us add a download button for reports
	// This would just print the button
	// Not the actual functionality
	// You would still need some JS and backend PHP
	// to make the download actually happen
	$buttons = array(
		__( 'Download', 'ipt_fsqm' ),
		'ipt_fsqm_report_print_' . $obj->form_id,
		'large',
		'ui',
		'normal',
		array( 'ipt_fsqm_report_download' ),
		'button',
		array(),
		array(),
		'',
		'download'
	);

	return $buttons;
}
add_filter( 'ipt_fsqm_filter_utilities_report_print', 'fsqm_report_custom_button', 10, 2 );

Source

Located in classes/class-ipt-fsqm-form-elements-utilities.php.

Filter: ipt_uif_valid_icons_image

Provides way to extend icon pack used eForm (and perhaps other WPQuark plugins and themes).

Filter Uses

This filter accepts one argument, an array which maps icon hexadecimal codes to respective image names. These images are used to replace icons where CSS webfonts aren’t an option (like email or PDF).

/**
 * Add more hex=>imageName to the icons mapping array
 *
 * @param      array  $icomoon_images  An array of hex => imageName pairing for indexed icons
 *
 * @return     array
 */
function fsqm_add_more_iconsimage( $icomoon_images ) {
	// Add more icons mapping to the imageset
	// See /lib/classes/var-ipt-icomoon-icons.php for more
	// Also check https://github.com/swashata/IcoMoonIconIndexer

	return $icomoon_images;
}
add_filter( 'ipt_uif_valid_icons_image', 'fsqm_add_more_iconsimage', 10, 1 );

Source

Located in lib/classes/class-ipt-plugin-uif-base.php.

Filter: ipt_uif_valid_icons_hex

Provides way to extend icon pack used eForm (and perhaps other WPQuark plugins and themes).

Filter Uses

Accepts an associative array of icons. Please see the code below.

/**
 * Add more icon classes and labels to the indexed iconset used by eForm
 *
 * @param      array  $icomoon_icons  An associative array of indexed icons
 *
 * @return     array
 */
function fsqm_add_more_iconshex( $icomoon_icons ) {
	// Add more icons mapping to the iconset
	// See /lib/classes/var-ipt-icomoon-icons.php for more
	// Also check https://github.com/swashata/IcoMoonIconIndexer

	return $icomoon_icons;
}
add_filter( 'ipt_uif_valid_icons_hex', 'fsqm_add_more_iconshex', 10, 1 );

Source

Located in lib/classes/class-ipt-plugin-uif-base.php.

Swashata has written 245 articles

Hi there, I am the Lead Developer at WPQuark.com. I love to create something beautiful for WordPress and here I write about how to use them. When I am not working, usually I am doing a number of other creative things ;).