Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808
Warning: foreach() argument must be of type array|object, string given in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 813
PUM_Triggers::add_trigger( array $trigger = array() )
Initializes a single trigger
Description Description
Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808
Warning: foreach() argument must be of type array|object, string given in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 813
Parameters Parameters
- $trigger
-
(Optional) The trigger array.
Default value: array()
Source Source
File: classes/Triggers.php
public function add_trigger( $trigger = array() ) { if ( ! empty( $trigger['id'] ) && ! isset( $this->triggers[ $trigger['id'] ] ) ) { $trigger = wp_parse_args( $trigger, array( 'id' => '', 'name' => '', 'modal_title' => '', 'settings_column' => '', 'priority' => 10, 'tabs' => $this->get_tabs(), 'fields' => array(), ) ); if ( empty( $trigger['modal_title'] ) && ! empty( $trigger['name'] ) ) { $trigger['modal_title'] = sprintf( _x( '%s Trigger Settings', 'trigger settings modal title', 'popup-maker' ), $trigger['name'] ); } // Here for backward compatibility to merge in labels properly. $labels = $this->get_labels(); $trigger_labels = isset( $labels[ $trigger['id'] ] ) ? $labels[ $trigger['id'] ] : array(); if ( ! empty( $trigger_labels ) ) { foreach ( $trigger_labels as $key => $value ) { if ( empty( $trigger[ $key ] ) ) { $trigger[ $key ] = $value; } } } // Remove cookie fields. if ( ! empty( $trigger['fields']['cookie'] ) ) { unset( $trigger['fields']['cookie'] ); } // Add cookie fields for all triggers automatically. if ( empty( $trigger['fields']['general']['cookie_name'] ) ) { $trigger['fields']['general'] = array_merge( $trigger['fields']['general'], $this->cookie_fields() ); } $this->triggers[ $trigger['id'] ] = apply_filters( 'pum_trigger', $trigger ); } }
Expand full source code Collapse full source code View on Trac