本文整理汇总了PHP中acf_is_local_field函数的典型用法代码示例。如果您正苦于以下问题:PHP acf_is_local_field函数的具体用法?PHP acf_is_local_field怎么用?PHP acf_is_local_field使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了acf_is_local_field函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _acf_get_field_by_key
function _acf_get_field_by_key($key = '', $db_only = false)
{
// try JSON before DB to save query time
if (!$db_only && acf_is_local_field($key)) {
return acf_get_local_field($key);
}
// vars
$post_id = acf_get_field_id($key);
// bail early if no post_id
if (!$post_id) {
return false;
}
// return
return _acf_get_field_by_id($post_id, $db_only);
}
示例2: acf_get_local_field
function acf_get_local_field($key)
{
// bail early if no field
if (!acf_is_local_field($key)) {
return false;
}
// return
return acf_local()->fields[$key];
}
示例3: _acf_get_field_by_key
function _acf_get_field_by_key($key = '', $db_only = false)
{
// try JSON before DB to save query time
if (!$db_only && acf_is_local_field($key)) {
$field = acf_get_local_field($key);
// validate
$field = acf_get_valid_field($field);
// return
return $field;
}
// vars
$post_id = acf_get_field_id($key);
// validate
if (!$post_id) {
return false;
}
// return
return _acf_get_field_by_id($post_id, $db_only);
}
示例4: _acf_get_field_by_key
function _acf_get_field_by_key($key = '')
{
// vars
$field = false;
// try JSON before DB to save query time
if (acf_is_local_field($key)) {
$field = acf_get_local_field($key);
// validate
$field = acf_get_valid_field($field);
// return
return $field;
}
// vars
$args = array('posts_per_page' => 1, 'post_type' => 'acf-field', 'orderby' => 'menu_order title', 'order' => 'ASC', 'suppress_filters' => false, 'acf_field_key' => $key);
// load posts
$posts = get_posts($args);
// validate
if (empty($posts)) {
return $field;
}
// load from ID
$field = _acf_get_field_by_id($posts[0]->ID);
// return
return $field;
}
示例5: add_field
function add_field($field)
{
// validate
$field = acf_get_valid_field($field);
// don't allow overrides
// edit: some manually created fields (via .php) used duplicate keys (copy of origional field).
/*
if( acf_is_local_field($field['key']) ) {
return;
}
*/
// vars
$parent = $field['parent'];
// append $parents
$this->parents[$parent][] = $field['key'];
// add in menu order
$field['menu_order'] = count($this->parents[$parent]) - 1;
// find ancestors
//$field['ancestors'] = array();
while (acf_is_local_field($parent)) {
//$field['ancestors'][] = $parent;
$parent = acf_get_local_field($parent);
$parent = $parent['parent'];
}
//$field['ancestors'][] = $field['field_group'];
// add field
$this->fields[$field['key']] = $field;
}