/** * Add custom parameters to pass to the JS via JSON. * * @since 1.0.0 * @access public * @return void */ public function json() { $json = parent::json(); $json['pro_text'] = $this->pro_text; $json['pro_url'] = esc_url($this->pro_url); return $json; }
/** * Get section params for JS. * * @since 4.3.0 * * @return array */ public function json() { $exported = parent::json(); $exported['menu_id'] = intval( preg_replace( '/^nav_menu\[(\d+)\]/', '$1', $this->id ) ); return $exported; }
/** * @see WP_Customize_Section::print_template() */ function test_print_templates_standard() { wp_set_current_user(self::$admin_id); $section = new WP_Customize_Section($this->manager, 'baz'); ob_start(); $section->print_template(); $content = ob_get_clean(); $this->assertContains('<script type="text/html" id="tmpl-customize-section-default">', $content); $this->assertContains('accordion-section-title', $content); $this->assertContains('accordion-section-content', $content); }
public function __construct($manager, $id, $args = array()) { //let the parent say what he needs to. We need to hear that sometimes. parent::__construct($manager, $id, $args); add_action('customize_controls_print_footer_scripts', array($this, 'hu_render_widget_zone_template'), 1); }
/** * Gather the parameters passed to client JavaScript via JSON. * * @since 4.1.0 * * @return array The array to be exported to the client as JSON. */ public function json() { $json = parent::json(); $json['sidebarId'] = $this->sidebar_id; return $json; }
/** * Export data to JS. * * @return array */ public function json() { $data = parent::json(); $data['noResourcesLoadedMessage'] = __('There are no REST API resources yet queried via the WP API JS client in the preview.', 'customize-rest-resources'); return $data; }
/** * @see WP_Customize_Section::print_template() */ function test_print_templates_standard() { wp_set_current_user($this->factory->user->create(array('role' => 'administrator'))); $section = new WP_Customize_Section($this->manager, 'baz'); ob_start(); $section->print_template(); $content = ob_get_clean(); $this->assertContains('<script type="text/html" id="tmpl-customize-section-default">', $content); $this->assertContains('accordion-section-title', $content); $this->assertContains('accordion-section-content', $content); }
/** * Gather the parameters passed to client JavaScript via JSON. * * @since 2.3.3 * * @return array The array to be exported to the client as JSON. */ public function json() { $array = parent::json(); $array['description'] = html_entity_decode($array['description'], ENT_QUOTES, get_bloginfo('charset')); return $array; }
/** * Gather the parameters passed to client JavaScript via JSON * * @return array */ public function json() { $exported = parent::json(); $exported['widgetType'] = (new \ReflectionClass($this))->getShortName(); return $exported; }