acf_admin_options_page::get_options_page_allowed_field_keys
Returns the top-level $_POST['acf'] keys of the fields in the field groups assigned to the current options page.
Since 6.8.11, saves also accept keys in the page's verified field lists; see get_options_page_save_args().
Метод класса: acf_admin_options_page{}
Хуки из метода
Возвращает
array.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_options_page_allowed_field_keys();
Список изменений
| С версии 6.8.7 | Введена. |
Код acf_admin_options_page::get_options_page_allowed_field_keys() acf admin options page::get options page allowed field keys ACF 6.8.11
protected function get_options_page_allowed_field_keys() {
$keys = array();
foreach ( $this->get_options_page_field_groups() as $field_group ) {
foreach ( (array) acf_get_fields( $field_group ) as $field ) {
$keys[] = acf_get_field_root_key( $field );
}
}
$keys = array_values( array_unique( array_filter( $keys ) ) );
/**
* Filters the list of $_POST['acf'] keys an options page save is allowed to save.
*
* Use this to permit additional field keys when a developer dynamically injects fields
* into an options page via JavaScript that aren't part of any field group assigned to
* the page.
*
* @since 6.8.7
*
* @param array $keys The allowed top-level $_POST['acf'] keys.
* @param array $page The current options page configuration.
*/
$keys = apply_filters( 'acf/options_page/allowed_field_keys', $keys, $this->page );
// Re-normalize after the filter so a misbehaving callback can't break array_flip() with non-scalar or empty values.
return acf_normalize_field_keys( $keys );
}