本文整理汇总了PHP中FW_Option_Type::get_default_id_prefix方法的典型用法代码示例。如果您正苦于以下问题:PHP FW_Option_Type::get_default_id_prefix方法的具体用法?PHP FW_Option_Type::get_default_id_prefix怎么用?PHP FW_Option_Type::get_default_id_prefix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FW_Option_Type
的用法示例。
在下文中一共展示了FW_Option_Type::get_default_id_prefix方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render_option
/**
* Render option enclosed in backend design
*
* @param string $id
* @param array $option
* @param array $data
* @param string $design default or taxonomy
*
* @return string
*/
public function render_option($id, $option, $data = array(), $design = null)
{
if (empty($design)) {
$design = $this->default_render_design;
}
if (!doing_action('admin_enqueue_scripts') && !did_action('admin_enqueue_scripts')) {
/**
* Do not wp_enqueue/register_...() because at this point not all handles has been registered
* and maybe they are used in dependencies in handles that are going to be enqueued.
* So as a result some handles will not be equeued because of not registered dependecies.
*/
} else {
$this->register_static();
}
if (!in_array($design, $this->available_render_designs)) {
trigger_error('Invalid render design specified: ' . $design, E_USER_WARNING);
$design = 'post';
}
if (!isset($data['id_prefix'])) {
$data['id_prefix'] = FW_Option_Type::get_default_id_prefix();
}
if (isset($option['option_handler']) && $option['option_handler'] instanceof FW_Option_Handler) {
/*
* if the option has a custom option_handler
* then the handler provides the option's value
*/
$data['value'] = $option['option_handler']->get_option_value($id, $option, $data);
}
return fw_render_view(fw_get_framework_directory('/views/backend-option-design-' . $design . '.php'), array('id' => $id, 'option' => $option, 'data' => $data));
}
示例2: render_option
/**
* Render option enclosed in backend design
*
* @param string $id
* @param array $option
* @param array $data
* @param string $design default or taxonomy
*
* @return string
*/
public function render_option($id, $option, $data = array(), $design = null)
{
if (empty($design)) {
$design = $this->default_render_design;
}
/**
* register scripts and styles
* in case if this method is called before enqueue_scripts action
* and option types has some of these in their dependencies
*/
$this->register_static();
if (!in_array($design, $this->available_render_designs)) {
trigger_error('Invalid render design specified: ' . $design, E_USER_WARNING);
$design = 'post';
}
if (!isset($data['id_prefix'])) {
$data['id_prefix'] = FW_Option_Type::get_default_id_prefix();
}
if (isset($option['option_handler']) && $option['option_handler'] instanceof FW_Option_Handler) {
/*
* if the option has a custom option_handler
* then the handler provides the option's value
*/
$data['value'] = $option['option_handler']->get_option_value($id, $option, $data);
}
return fw_render_view(fw_get_framework_directory('/views/backend-option-design-' . $design . '.php'), array('id' => $id, 'option' => $option, 'data' => $data));
}
示例3: render_option
/**
* Render option enclosed in backend design
*/
public function render_option($id, $option, $data = array(), $design = 'default')
{
/**
* register scripts and styles
* in case if this method is called before enqueue_scripts action
* and option types has some of these in their dependencies
*/
$this->register_static();
if (!in_array($design, $this->available_render_designs)) {
trigger_error('Invalid render design specified: ' . $design, E_USER_WARNING);
$design = 'post';
}
if (!isset($data['id_prefix'])) {
$data['id_prefix'] = FW_Option_Type::get_default_id_prefix();
}
return fw_render_view(FW_DIR . '/views/backend-option-design-' . $design . '.php', array('id' => $id, 'option' => $option, 'data' => $data));
}
示例4: prepare
/**
* Fixes and prepare defaults
*
* @param string $id
* @param array $option
* @param array $data
* @return array
*/
private function prepare($id, &$option, &$data)
{
$data = array_merge(array('id_prefix' => FW_Option_Type::get_default_id_prefix(), 'name_prefix' => FW_Option_Type::get_default_name_prefix()), $data);
$option = array_merge($this->get_defaults(), $option, array('type' => $this->get_type()));
if (!isset($option['attr'])) {
$option['attr'] = array();
}
if (!isset($option['title'])) {
$option['title'] = fw_id_to_title($id);
}
$option['attr']['class'] = 'fw-container fw-container-type-' . $option['type'] . (isset($option['attr']['class']) ? ' ' . $option['attr']['class'] : '');
}