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
PUM_Admin_Popups::fields()

Returns array of popup settings fields.


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

Return Return

(mixed)


Top ↑

Source Source

File: classes/Admin/Popups.php

	public static function fields() {

		static $tabs;

		if ( ! isset( $tabs ) ) {
			$tabs = apply_filters( 'pum_popup_settings_fields', array(
				'general'   => apply_filters( 'pum_popup_general_settings_fields', array(
					'main' => array(),
				) ),
				'triggers'  => apply_filters( 'pum_popup_triggers_settings_fields', array(
					'main' => array(
						'triggers'   => array(
							'type'     => 'triggers',
							'std'      => array(),
							'priority' => 10,
						),
						'separator1' => array(
							'type'    => 'separator',
							'private' => true,
						),
						'cookies'    => array(
							'type'     => 'cookies',
							'std'      => array(),
							'priority' => 20,
						),
					),
				) ),
				'targeting' => apply_filters( 'pum_popup_targeting_settings_fields', array(
					'main' => array(
						'conditions'        => array(
							'type'     => 'conditions',
							'std'      => array(),
							'priority' => 10,
							'private'  => true,
						),
						'disable_on_mobile' => array(
							'label'    => __( 'Disable this popup on mobile devices.', 'popup-maker' ),
							'type'     => 'checkbox',
							'priority' => 20,
						),
						'disable_on_tablet' => array(
							'label'    => __( 'Disable this popup on tablet devices.', 'popup-maker' ),
							'type'     => 'checkbox',
							'priority' => 20,
						),
					),
				) ),
				'display'   => apply_filters( 'pum_popup_display_settings_fields', array(
					'preset'    => array(
						'explain' => array(
							'type'    => 'html',
							'content' => '<p>Select one of the types below to get started! Once selected, you can adjust the display settings using the tabs above.</p>'
						),
						'type_section' => array(
							'type'    => 'section',
							'classes' => 'popup-types',
							'fields'  => array(
								'<div class="popup-type" data-popup-type="center-popup"><img src="' . Popup_Maker::$URL  . 'assets/images/admin/display-switcher/center-popup.png" alt="' . __( 'Center Popup', 'popup-maker' ) . '"/><button class="button">' . __( 'Center Popup', 'popup-maker' ) . '</button></div>',
								'<div class="popup-type" data-popup-type="right-bottom-slidein"><img src="' . Popup_Maker::$URL  . 'assets/images/admin/display-switcher/right-bottom-slidein.png" alt="' . __( 'Right Bottom Slide-in', 'popup-maker' ) . '"/><button class="button">' . __( 'Right Bottom Slide-in', 'popup-maker' ) . '</button></div>',
								'<div class="popup-type" data-popup-type="top-bar"><img src="' . Popup_Maker::$URL  . 'assets/images/admin/display-switcher/top-bar.png" alt="' . __( 'Top Bar', 'popup-maker' ) . '"/><button class="button">' . __( 'Top Bar', 'popup-maker' ) . '</button></div>',
								'<div class="popup-type" data-popup-type="left-bottom-notice"><img src="' . Popup_Maker::$URL  . 'assets/images/admin/display-switcher/left-bottom-notice.png" alt="' . __( 'Left Bottom Notice', 'popup-maker' ) . '"/><button class="button">' . __( 'Left Bottom Notice', 'popup-maker' ) . '</button></div>',
							),
						),
					),
					'main'      => array(
						'theme_id' => array(
							'label'        => __( 'Popup Theme', 'popup-maker' ),
							'dynamic_desc' => sprintf( '%1$s<br/><a id="edit_theme_link" href="%3$s">%2$s</a>', __( 'Choose a theme for this popup.', 'popup-maker' ), __( 'Customize This Theme', 'popup-maker' ), admin_url( "post.php?action=edit&post={{data.value}}" ) ),
							'type'         => 'select',
							'options'      => pum_is_popup_editor() ? PUM_Helpers::popup_theme_selectlist() : null,
							'std'          => pum_get_default_theme_id(),
						),
					),
					'size'      => array(
						'size'                 => array(
							'label'    => __( 'Size', 'popup-maker' ),
							'desc'     => __( 'Select the size of the popup.', 'popup-maker' ),
							'type'     => 'select',
							'std'      => 'medium',
							'priority' => 10,
							'options'  => array(
								__( 'Responsive Sizes', 'popup-maker' ) => array(
									'nano'   => __( 'Nano - 10%', 'popup-maker' ),
									'micro'  => __( 'Micro - 20%', 'popup-maker' ),
									'tiny'   => __( 'Tiny - 30%', 'popup-maker' ),
									'small'  => __( 'Small - 40%', 'popup-maker' ),
									'medium' => __( 'Medium - 60%', 'popup-maker' ),
									'normal' => __( 'Normal - 70%', 'popup-maker' ),
									'large'  => __( 'Large - 80%', 'popup-maker' ),
									'xlarge' => __( 'X Large - 95%', 'popup-maker' ),
								),
								__( 'Other Sizes', 'popup-maker' )      => array(
									'auto'   => __( 'Auto', 'popup-maker' ),
									'custom' => __( 'Custom', 'popup-maker' ),
								),
							),
						),
						'responsive_min_width' => array(
							'label'        => __( 'Min Width', 'popup-maker' ),
							'desc'         => __( 'Set a minimum width for the popup.', 'popup-maker' ),
							'type'         => 'measure',
							'std'          => '0%',
							'priority'     => 20,
							'dependencies' => array(
								'size' => array( 'nano', 'micro', 'tiny', 'small', 'medium', 'normal', 'large', 'xlarge' ),
							),
						),
						'responsive_max_width' => array(
							'label'        => __( 'Max Width', 'popup-maker' ),
							'desc'         => __( 'Set a maximum width for the popup.', 'popup-maker' ),
							'type'         => 'measure',
							'std'          => '100%',
							'priority'     => 30,
							'dependencies' => array(
								'size' => array( 'nano', 'micro', 'tiny', 'small', 'medium', 'normal', 'large', 'xlarge' ),
							),
						),
						'custom_width'         => array(
							'label'        => __( 'Width', 'popup-maker' ),
							'desc'         => __( 'Set a custom width for the popup.', 'popup-maker' ),
							'type'         => 'measure',
							'std'          => '640px',
							'priority'     => 40,
							'dependencies' => array(
								'size' => 'custom',
							),
						),
						'custom_height_auto'   => array(
							'label'        => __( 'Auto Adjusted Height', 'popup-maker' ),
							'desc'         => __( 'Checking this option will set height to fit the content.', 'popup-maker' ),
							'type'         => 'checkbox',
							'priority'     => 50,
							'dependencies' => array(
								'size' => 'custom',
							),
						),
						'custom_height'        => array(
							'label'        => __( 'Height', 'popup-maker' ),
							'desc'         => __( 'Set a custom height for the popup.', 'popup-maker' ),
							'type'         => 'measure',
							'std'          => '380px',
							'priority'     => 60,
							'dependencies' => array(
								'size'               => 'custom',
								'custom_height_auto' => false,
							),
						),
						'scrollable_content'   => array(
							'label'        => __( 'Scrollable Content', 'popup-maker' ),
							'desc'         => __( 'Checking this option will add a scroll bar to your content.', 'popup-maker' ),
							'type'         => 'checkbox',
							'std'          => false,
							'priority'     => 70,
							'dependencies' => array(
								'size'               => 'custom',
								'custom_height_auto' => false,
							),
						),
					),
					'animation' => array(
						'animation_type'   => array(
							'label'    => __( 'Animation Type', 'popup-maker' ),
							'desc'     => __( 'Select an animation type for your popup.', 'popup-maker' ),
							'type'     => 'select',
							'std'      => 'fade',
							'priority' => 10,
							'options'  => array(
								'none'         => __( 'None', 'popup-maker' ),
								'slide'        => __( 'Slide', 'popup-maker' ),
								'fade'         => __( 'Fade', 'popup-maker' ),
								'fadeAndSlide' => __( 'Fade and Slide', 'popup-maker' ),
								// 'grow'         => __( 'Grow', 'popup-maker' ),
								// 'growAndSlide' => __( 'Grow and Slide', 'popup-maker' ),
							),
						),
						'animation_speed'  => array(
							'label'        => __( 'Animation Speed', 'popup-maker' ),
							'desc'         => __( 'Set the animation speed for the popup.', 'popup-maker' ),
							'type'         => 'rangeslider',
							'std'          => 350,
							'step'         => 10,
							'min'          => 50,
							'max'          => 1000,
							'unit'         => __( 'ms', 'popup-maker' ),
							'priority'     => 20,
							'dependencies' => array(
								'animation_type' => array( 'slide', 'fade', 'fadeAndSlide', 'grow', 'growAndSlide' ),
							),
						),
						'animation_origin' => array(
							'label'        => __( 'Animation Origin', 'popup-maker' ),
							'desc'         => __( 'Choose where the animation will begin.', 'popup-maker' ),
							'type'         => 'select',
							'std'          => 'center top',
							'options'      => array(
								'top'           => __( 'Top', 'popup-maker' ),
								'left'          => __( 'Left', 'popup-maker' ),
								'bottom'        => __( 'Bottom', 'popup-maker' ),
								'right'         => __( 'Right', 'popup-maker' ),
								'left top'      => __( 'Top Left', 'popup-maker' ),
								'center top'    => __( 'Top Center', 'popup-maker' ),
								'right top'     => __( 'Top Right', 'popup-maker' ),
								'left center'   => __( 'Middle Left', 'popup-maker' ),
								'center center' => __( 'Middle Center', 'popup-maker' ),
								'right center'  => __( 'Middle Right', 'popup-maker' ),
								'left bottom'   => __( 'Bottom Left', 'popup-maker' ),
								'center bottom' => __( 'Bottom Center', 'popup-maker' ),
								'right bottom'  => __( 'Bottom Right', 'popup-maker' ),
							),
							'priority'     => 30,
							'dependencies' => array(
								'animation_type' => array( 'slide', 'fadeAndSlide', 'grow', 'growAndSlide' ),
							),
						),
					),
					'sound' => array(
						'open_sound'   => array(
							'label'    => __( 'Opening Sound', 'popup-maker' ),
							'desc'     => __( 'Select a sound to play when the popup opens.', 'popup-maker' ),
							'type'     => 'select',
							'std'      => 'none',
							'priority' => 10,
							'options'  => array(
								'none'         => __( 'None', 'popup-maker' ),
								'beep.mp3'     => __( 'Beep', 'popup-maker' ),
								'beep-two.mp3' => __( 'Beep 2', 'popup-maker' ),
								'beep-up.mp3'  => __( 'Beep Up', 'popup-maker' ),
								'chimes.mp3'   => __( 'Chimes', 'popup-maker' ),
								'correct.mp3'  => __( 'Correct', 'popup-maker' ),
								'custom'       => __( 'Custom Sound', 'popup-maker' ),
							),
						),
						'custom_sound'   => array(
							'label'    => __( 'Custom Sound URL', 'popup-maker' ),
							'desc'     => __( 'Enter URL to sound file.', 'popup-maker' ),
							'type'     => 'text',
							'std'      => '',
							'priority' => 10,
							'dependencies' => array(
								'open_sound' => array( 'custom' ),
							),
						),
					),
					'position'  => array(
						'location'              => array(
							'label'    => __( 'Location', 'popup-maker' ),
							'desc'     => __( 'Choose where the popup will be displayed.', 'popup-maker' ),
							'type'     => 'select',
							'std'      => 'center top',
							'priority' => 10,
							'options'  => array(
								'left top'      => __( 'Top Left', 'popup-maker' ),
								'center top'    => __( 'Top Center', 'popup-maker' ),
								'right top'     => __( 'Top Right', 'popup-maker' ),
								'left center'   => __( 'Middle Left', 'popup-maker' ),
								'center'        => __( 'Middle Center', 'popup-maker' ),
								'right center'  => __( 'Middle Right', 'popup-maker' ),
								'left bottom'   => __( 'Bottom Left', 'popup-maker' ),
								'center bottom' => __( 'Bottom Center', 'popup-maker' ),
								'right bottom'  => __( 'Bottom Right', 'popup-maker' ),
							),
						),
						'position_top'          => array(
							'label'        => __( 'Top', 'popup-maker' ),
							'desc'         => sprintf( _x( 'Distance from the %s edge of the screen.', 'Screen Edge: top, bottom', 'popup-maker' ), strtolower( __( 'Top', 'popup-maker' ) ) ),
							'type'         => 'rangeslider',
							'std'          => 100,
							'step'         => 1,
							'min'          => 0,
							'max'          => 500,
							'unit'         => 'px',
							'priority'     => 20,
							'dependencies' => array(
								'location' => array( 'left top', 'center top', 'right top' ),
							),
						),
						'position_bottom'       => array(
							'label'        => __( 'Bottom', 'popup-maker' ),
							'desc'         => sprintf( _x( 'Distance from the %s edge of the screen.', 'Screen Edge: top, bottom', 'popup-maker' ), strtolower( __( 'Bottom', 'popup-maker' ) ) ),
							'type'         => 'rangeslider',
							'std'          => 0,
							'step'         => 1,
							'min'          => 0,
							'max'          => 500,
							'unit'         => 'px',
							'priority'     => 20,
							'dependencies' => array(
								'location' => array( 'left bottom', 'center bottom', 'right bottom' ),
							),
						),
						'position_left'         => array(
							'label'        => __( 'Left', 'popup-maker' ),
							'desc'         => sprintf( _x( 'Distance from the %s edge of the screen.', 'Screen Edge: top, bottom', 'popup-maker' ), strtolower( __( 'Left', 'popup-maker' ) ) ),
							'type'         => 'rangeslider',
							'std'          => 0,
							'step'         => 1,
							'min'          => 0,
							'max'          => 500,
							'unit'         => 'px',
							'priority'     => 30,
							'dependencies' => array(
								'location' => array( 'left top', 'left center', 'left bottom' ),
							),
						),
						'position_right'        => array(
							'label'        => __( 'Right', 'popup-maker' ),
							'desc'         => sprintf( _x( 'Distance from the %s edge of the screen.', 'Screen Edge: top, bottom', 'popup-maker' ), strtolower( __( 'Right', 'popup-maker' ) ) ),
							'type'         => 'rangeslider',
							'std'          => 0,
							'step'         => 1,
							'min'          => 0,
							'max'          => 500,
							'unit'         => 'px',
							'priority'     => 30,
							'dependencies' => array(
								'location' => array( 'right top', 'right center', 'right bottom' ),
							),
						),
						'position_from_trigger' => array(
							'label'    => __( 'Position from Trigger', 'popup-maker' ),
							'desc'     => sprintf( __( 'This will position the popup in relation to the %sClick Trigger%s.', 'popup-maker' ), '<a target="_blank" href="https://docs.wppopupmaker.com/article/395-trigger-click-open-overview-methods?utm_campaign=contextual-help&utm_medium=inline-doclink&utm_source=plugin-popup-editor&utm_content=position-from-trigger">', '</a>' ),
							'type'     => 'checkbox',
							'std'      => false,
							'priority' => 40,
						),
						'position_fixed'        => array(
							'label'    => __( 'Fixed Postioning', 'popup-maker' ),
							'desc'     => __( 'Checking this sets the positioning of the popup to fixed.', 'popup-maker' ),
							'type'     => 'checkbox',
							'priority' => 50,
						),
					),
					'advanced'  => array(
						'overlay_disabled'   => array(
							'label'    => __( 'Disable Overlay', 'popup-maker' ),
							'desc'     => __( 'Checking this will disable and hide the overlay for this popup.', 'popup-maker' ),
							'type'     => 'checkbox',
							'priority' => 10,
						),
						'stackable'          => array(
							'label'    => __( 'Stackable', 'popup-maker' ),
							'desc'     => __( 'This enables other popups to remain open.', 'popup-maker' ),
							'type'     => 'checkbox',
							'priority' => 20,
						),
						'disable_reposition' => array(
							'label'    => __( 'Disable Repositioning', 'popup-maker' ),
							'desc'     => __( 'This will disable automatic repositioning of the popup on window resizing.', 'popup-maker' ),
							'type'     => 'checkbox',
							'priority' => 30,
						),
						'zindex'             => array(
							'label'    => __( 'Popup Z-Index', 'popup-maker' ),
							'desc'     => __( 'Change the z-index layer level for the popup.', 'popup-maker' ),
							'type'     => 'number',
							'min'      => 999,
							'max'      => 2147483647,
							'std'      => 1999999999,
							'priority' => 40,
						),
					),
				) ),
				'close'     => apply_filters( 'pum_popup_close_settings_fields', array(
					'button'            => array(
						'close_text'         => array(
							'label'       => __( 'Close Text', 'popup-maker' ),
							'placeholder' => __( 'Close', 'popup-maker' ),
							'desc'        => __( 'Override the default close text. To use a Font Awesome icon instead of text, enter the CSS classes such as "fas fa-camera".', 'popup-maker' ),
							'priority'    => 10,
							'private'     => true,
						),
						'close_button_delay' => array(
							'label'    => __( 'Close Button Delay', 'popup-maker' ),
							'desc'     => __( 'This delays the display of the close button.', 'popup-maker' ),
							'type'     => 'rangeslider',
							'std'      => 0,
							'step'     => 100,
							'min'      => 0,
							'max'      => 3000,
							'unit'     => __( 'ms', 'popup-maker' ),
							'priority' => 20,
						),
					),
					'forms' => [
						'close_on_form_submission'          => [
							'label' => __( 'Close on Form Submission', 'popup-maker' ),
							'desc'  => __( 'Close the popup automatically after integrated form plugin submissions.', 'popup-maker' ),
							'type'  => 'checkbox',
						],
						'close_on_form_submission_delay'    => [
							'type'         => 'rangeslider',
							'label'        => __( 'Delay', 'popup-maker' ),
							'desc'         => __( 'The delay before the popup will close after submission (in milliseconds).', 'popup-maker' ),
							'std'          => 0,
							'min'          => 0,
							'max'          => 10000,
							'step'         => 500,
							'unit'         => 'ms',
							'dependencies' => [
								'close_on_form_submission' => true,
							],
						],
					],
					'alternate_methods' => array(
						'close_on_overlay_click' => array(
							'label'    => __( 'Click Overlay to Close', 'popup-maker' ),
							'desc'     => __( 'Checking this will cause popup to close when user clicks on overlay.', 'popup-maker' ),
							'type'     => 'checkbox',
							'priority' => 10,
						),
						'close_on_esc_press'     => array(
							'label'    => __( 'Press ESC to Close', 'popup-maker' ),
							'desc'     => __( 'Checking this will cause popup to close when user presses ESC key.', 'popup-maker' ),
							'type'     => 'checkbox',
							'priority' => 20,
						),
						'close_on_f4_press'      => array(
							'label'    => __( 'Press F4 to Close', 'popup-maker' ),
							'desc'     => __( 'Checking this will cause popup to close when user presses F4 key.', 'popup-maker' ),
							'type'     => 'checkbox',
							'priority' => 30,
						),
					),
				) ),
				'advanced'  => apply_filters( 'pum_popup_advanced_settings_fields', array(
					'main' => array(
						'disable_form_reopen'   => array(
							'label'    => __( 'Disable automatic re-triggering of popup after non-ajax form submission.', 'popup-maker' ),
							'type'     => 'checkbox',
							'priority' => 10,
						),
						'disable_accessibility' => array(
							'label'    => __( 'Disable accessibility features.', 'popup-maker' ),
							'desc'     => __( 'This includes trapping the tab key & focus inside popup while open, force focus the first element when popup open, and refocus last click trigger when closed.', 'popup-maker' ),
							'type'     => 'checkbox',
							'priority' => 10,
						),
					),
				) ),
			) );

			foreach ( $tabs as $tab_id => $sections ) {

				foreach ( $sections as $section_id => $fields ) {

					if ( PUM_Admin_Helpers::is_field( $fields ) ) {
						// Allow for flat tabs with no sections.
						$section_id = 'main';
						$fields     = array(
							$section_id => $fields,
						);
					}

					foreach ( $fields as $field_id => $field ) {
						if ( ! is_array( $field ) || ! PUM_Admin_Helpers::is_field( $field ) ) {
							continue;
						}

						if ( empty( $field['id'] ) ) {
							$field['id'] = $field_id;
						}
						if ( empty( $field['name'] ) ) {
							$field['name'] = 'popup_settings[' . $field_id . ']';
						}

						$tabs[ $tab_id ][ $section_id ][ $field_id ] = wp_parse_args( $field, array(
							'section'      => 'main',
							'type'         => 'text',
							'id'           => null,
							'label'        => '',
							'desc'         => '',
							'name'         => null,
							'templ_name'   => null,
							'size'         => 'regular',
							'options'      => array(),
							'std'          => null,
							'rows'         => 5,
							'cols'         => 50,
							'min'          => 0,
							'max'          => 50,
							'force_minmax' => false,
							'step'         => 1,
							'select2'      => null,
							'object_type'  => 'post_type',
							'object_key'   => 'post',
							'post_type'    => null,
							'taxonomy'     => null,
							'multiple'     => null,
							'as_array'     => false,
							'placeholder'  => null,
							'checkbox_val' => 1,
							'allow_blank'  => true,
							'readonly'     => false,
							'required'     => false,
							'disabled'     => false,
							'hook'         => null,
							'unit'         => __( 'ms', 'popup-maker' ),
							'units'        => array(
								'px'  => 'px',
								'%'   => '%',
								'em'  => 'em',
								'rem' => 'rem',
							),
							'priority'     => null,
							'doclink'      => '',
							'button_type'  => 'submit',
							'class'        => '',
							'private'      => false,
						) );

					}
				}
			}
		}


		return $tabs;
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.