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_Cookies::add_cookie( null $cookie = null )


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

$cookie

(Optional)

Default value: null


Top ↑

Source Source

File: classes/Cookies.php

	public function add_cookie( $cookie = null ) {
		if ( ! empty( $cookie['id'] ) && ! isset ( $this->cookies[ $cookie['id'] ] ) ) {
			$cookie = wp_parse_args( $cookie, array(
				'id'              => '',
				'name'            => '',
				'modal_title'     => __( 'Cookie Settings', 'popup-maker' ),
				'settings_column' => sprintf( '%s%s%s', '<# if (typeof data.session === "undefined" || data.session !== "1") { print(data.time); } else { print("', __( 'Sessions', 'popup-maker' ), '"); } #>' ),
				'priority'        => 10,
				'tabs'            => $this->get_tabs(),
				'fields'          => $this->cookie_fields(),
			) );

			// Here for backward compatibility to merge in labels properly.
			if ( ! empty( $cookie['labels'] ) ) {
				foreach ( $cookie['labels'] as $key => $value ) {
					$cookie[ $key ] = $value;
					unset( $cookie['labels'][ $key ] );
				}
				unset( $cookie['labels'] );
			}

			// Add cookie fields for all cookies automatically.
			if ( empty( $cookie['fields'] ) ) {
				$cookie['fields'] = $this->cookie_fields();
			}

			$cookie['fields'] = PUM_Admin_Helpers::parse_tab_fields( $cookie['fields'], array(
				'has_subtabs' => false,
				'name'        => '%s',
			) );

			$this->cookies[ $cookie['id'] ] = $cookie;
		}

		return;

	}


Top ↑

User Contributed Notes User Contributed Notes

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