本文整理汇总了PHP中RW_Meta_Box::normalize方法的典型用法代码示例。如果您正苦于以下问题:PHP RW_Meta_Box::normalize方法的具体用法?PHP RW_Meta_Box::normalize怎么用?PHP RW_Meta_Box::normalize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RW_Meta_Box
的用法示例。
在下文中一共展示了RW_Meta_Box::normalize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: find_field
/**
* Find field by field ID.
* This function finds field in meta boxes registered by 'rwmb_meta_boxes' filter.
*
* @param string $field_id Field ID
* @return array|false Field params (array) if success. False otherwise.
*/
static function find_field($field_id)
{
$meta_boxes = RWMB_Core::get_meta_boxes();
foreach ($meta_boxes as $meta_box) {
$meta_box = RW_Meta_Box::normalize($meta_box);
foreach ($meta_box['fields'] as $field) {
if ($field_id == $field['id']) {
return $field;
}
}
}
return false;
}
示例2: find_field
/**
* Find field by field ID
* This function finds field in meta boxes registered by 'wcqd_metabox_meta_boxes' filter
* Note: if users use old code to add meta boxes, this function might not work properly
*
* @param string $field_id Field ID
*
* @return array|false Field params (array) if success. False otherwise.
*/
static function find_field($field_id)
{
// Get all meta boxes registered with 'wcqd_metabox_meta_boxes' hook
$meta_boxes = apply_filters('wcqd_metabox_meta_boxes', array());
// Find field
foreach ($meta_boxes as $meta_box) {
$meta_box = RW_Meta_Box::normalize($meta_box);
foreach ($meta_box['fields'] as $field) {
if ($field_id == $field['id']) {
return $field;
}
}
}
return false;
}
示例3: hash_fields
/**
* Hash all fields into an indexed array for search
*
* @param string $post_type Post type
*/
public static function hash_fields($post_type)
{
self::$fields[$post_type] = array();
$meta_boxes = RWMB_Core::get_meta_boxes();
foreach ($meta_boxes as $meta_box) {
$meta_box = RW_Meta_Box::normalize($meta_box);
if (!in_array($post_type, $meta_box['post_types'])) {
continue;
}
foreach ($meta_box['fields'] as $field) {
if (!empty($field['id'])) {
self::$fields[$post_type][$field['id']] = $field;
}
}
}
}