_acf_get_located_field_keys()
Returns the submitted keys that belong to a top-level field of a field group located on the object.
Keys are matched by top-level input key only. Field names aren't accepted: acf_update_values() looks a name up across every field, so it could save as a different field with the same name.
Внутренняя функция — эта функция рассчитана на использование самим ядром. Не рекомендуется использовать эту функцию в своем коде.
Хуков нет.
Возвращает
array.
Использование
_acf_get_located_field_keys( $candidates, $screen, $flat_clone_keys );
- $candidates(массив) (обязательный)
- The submitted top-level keys to check.
- $screen(массив) (обязательный)
- The location screen args describing the object. Empty matches nothing.
- $flat_clone_keys(true|false)
- Whether seamless clone sub fields may also be submitted under their own keys (the datastore).
По умолчанию:false
Список изменений
| С версии 6.8.11 | Введена. |
Код _acf_get_located_field_keys() acf get located field keys ACF 6.8.11
function _acf_get_located_field_keys( $candidates, $screen, $flat_clone_keys = false ) {
// An empty screen would match every field group.
if ( ! $candidates || empty( $screen ) || ! is_array( $screen ) ) {
return array();
}
$located = array();
foreach ( acf_get_field_groups( $screen ) as $field_group ) {
foreach ( (array) acf_get_fields( $field_group ) as $field ) {
$located[ acf_get_field_root_key( $field ) ] = true;
foreach ( $flat_clone_keys ? _acf_get_flat_clone_keys( $field ) : array() as $key ) {
$located[ $key ] = true;
}
}
}
return array_values( array_intersect( $candidates, array_map( 'strval', array_keys( $located ) ) ) );
}