/** * 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::json() */ function test_json() { $args = array('priority' => 200, 'capability' => 'edit_posts', 'theme_supports' => 'html5', 'title' => 'Hello World', 'description' => 'Lorem Ipsum', 'type' => 'horizontal', 'panel' => 'bar', 'active_callback' => '__return_true'); $this->manager->add_panel('bar'); $section = new WP_Customize_Section($this->manager, 'foo', $args); $data = $section->json(); $this->assertEquals('foo', $data['id']); foreach (array('title', 'description', 'priority', 'panel', 'type') as $key) { $this->assertEquals($args[$key], $data[$key]); } $this->assertEmpty($data['content']); $this->assertTrue($data['active']); $this->assertInternalType('int', $data['instanceNumber']); }
/** * 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; }
/** * 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; }