本文整理汇总了PHP中WP_Customize_Manager::get_customizer_object_name方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Customize_Manager::get_customizer_object_name方法的具体用法?PHP WP_Customize_Manager::get_customizer_object_name怎么用?PHP WP_Customize_Manager::get_customizer_object_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WP_Customize_Manager
的用法示例。
在下文中一共展示了WP_Customize_Manager::get_customizer_object_name方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor.
*
* Supplied $args override class property defaults.
*
* If $args['fields'] is not defined, use the $id as the field ID.
*
* @since 3.4.0
*
* @param WP_Customize_Manager $manager
* @param string $id
* @param array $args
*/
public function __construct($manager, $id, $args = array())
{
$this->manager = $manager;
$this->object_name = $this->manager->get_customizer_object_name();
// Backwards compatibility for old property names
foreach ($this->property_map as $backcompat_arg => $actual_arg) {
if (isset($args[$backcompat_arg])) {
$args[$actual_arg] = $args[$backcompat_arg];
unset($args[$backcompat_arg]);
}
}
parent::__construct($this->object_type, $id, $args);
if (empty($this->active_callback)) {
$this->active_callback = array($this, 'active_callback');
}
if (!has_action('fields_render_control_' . $this->object_type, array('WP_Customize_Control', 'customize_render_control'))) {
add_action('fields_render_control_' . $this->object_type, array('WP_Customize_Control', 'customize_render_control'));
}
if (!has_filter('fields_control_active_' . $this->object_type, array('WP_Customize_Control', 'customize_control_active'))) {
add_filter('fields_control_active_' . $this->object_type, array('WP_Customize_Control', 'customize_control_active'), 10, 2);
}
if ('' !== $this->id) {
add_action('fields_render_control_' . $this->object_type . '_' . $this->object_name . '_' . $this->id, array('WP_Customize_Control', 'customize_render_control_id'));
}
}
示例2: __construct
/**
* Constructor.
*
* Any supplied $args override class property defaults.
*
* @since 4.0.0
*
* @param WP_Customize_Manager $manager Customizer bootstrap instance.
* @param string $id An specific ID for the panel.
* @param array $args Panel arguments.
*/
public function __construct($manager, $id, $args = array())
{
$this->manager = $manager;
$this->object_name = $this->manager->get_customizer_object_name();
parent::__construct($this->object_type, $id, $args);
if (!has_filter("fields_api_screen_active_{$this->object_type}", array('WP_Customize_Panel', 'customize_panel_active'))) {
add_filter("fields_api_screen_active_{$this->object_type}", array('WP_Customize_Panel', 'customize_panel_active'), 10, 2);
}
if (!has_action("fields_api_render_screen_{$this->object_type}", array('WP_Customize_Panel', 'customize_render_panel'))) {
add_action("fields_api_render_screen_{$this->object_type}", array('WP_Customize_Panel', 'customize_render_panel'));
}
if ('' !== $this->id) {
add_action("fields_api_render_screen_{$this->object_type}_{$this->object_name}_{$this->id}", array($this, 'customize_render_panel_id'));
}
}
示例3: __construct
/**
* Constructor.
*
* Any supplied $args override class property defaults.
*
* @since 3.4.0
*
* @param WP_Customize_Manager $manager
* @param string $id An specific ID of the setting. Can be a
* theme mod or option name.
* @param array $args Setting arguments.
*/
public function __construct($manager, $id, $args = array())
{
$this->manager = $manager;
$this->object_name = $this->manager->get_customizer_object_name();
// Backwards compatibility for callbacks on old filters,
// Remove from args so they don't get handled by WP Fields API
$sanitize_callback = null;
$sanitize_js_callback = null;
if (!empty($args['sanitize_callback'])) {
$sanitize_callback = $args['sanitize_callback'];
unset($args['sanitize_callback']);
}
if (!empty($args['sanitize_js_callback'])) {
$sanitize_js_callback = $args['sanitize_js_callback'];
unset($args['sanitize_js_callback']);
}
parent::__construct($this->object_type, $id, $args);
if ($sanitize_callback) {
add_filter("customize_sanitize_{$this->id}", $sanitize_callback);
$this->sanitize_callback = $sanitize_callback;
}
if ($sanitize_js_callback) {
add_filter("customize_sanitize_js_{$this->id}", $sanitize_js_callback);
$this->sanitize_js_callback = $sanitize_js_callback;
}
// @todo Figure out proper backwards compat for $this->type vs $this->object_type in hooks
// @todo Add methods that hook into $this->object_type hooks instead, and run $this->type logic for backwards compat
// Add compatibility hooks
add_filter("fields_sanitize_{$this->object_type}_{$this->object_name}_{$this->id}", array($this, 'customize_sanitize'));
add_filter("fields_sanitize_js_{$this->object_type}_{$this->object_name}_{$this->id}", array($this, 'customize_sanitize_js_value'));
}
示例4: __construct
/**
* Constructor.
*
* Any supplied $args override class property defaults.
*
* @since 3.4.0
*
* @param WP_Customize_Manager $manager Customizer bootstrap instance.
* @param string $id An specific ID of the section.
* @param array $args Section arguments.
*/
public function __construct($manager, $id, $args = array())
{
$this->manager = $manager;
$this->object_name = $manager->get_customizer_object_name();
// Backwards compatibility for old property names
foreach ($this->property_map as $backcompat_arg => $actual_arg) {
if (isset($args[$backcompat_arg])) {
$args[$actual_arg] = $args[$backcompat_arg];
unset($args[$backcompat_arg]);
}
}
parent::__construct($this->object_type, $id, $args);
if (!has_action("fields_api_section_active_{$this->object_type}", array('WP_Customize_Section', 'customize_section_active'))) {
add_action("fields_api_section_active_{$this->object_type}", array('WP_Customize_Section', 'customize_section_active'), 10, 2);
}
if (!has_action("fields_api_render_section_{$this->object_type}", array('WP_Customize_Section', 'customize_render_section'))) {
add_action("fields_api_render_section_{$this->object_type}", array('WP_Customize_Section', 'customize_render_section'));
}
if ('' !== $this->id) {
add_action("fields_api_render_section_{$this->object_type}_{$this->object_name}_{$this->id}", array($this, 'customize_render_section_id'));
}
}