WPSEO_Option::array_filter_merge()
Helper method - Combines a fixed array of default values with an options array while filtering out any keys which are not in the defaults array.
Метод класса: WPSEO_Option{}
Хуков нет.
Возвращает
Массив
. Combined and filtered options array.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->array_filter_merge( $options );
- $options(массив|null)
- Current options. If not set, the option defaults for the $option_key will be returned.
По умолчанию: null
Код WPSEO_Option::array_filter_merge() WPSEO Option::array filter merge Yoast 22.3
protected function array_filter_merge( $options = null ) { $defaults = $this->get_defaults(); if ( ! isset( $options ) || $options === false || $options === [] ) { return $defaults; } $options = (array) $options; /* $filtered = array(); if ( $defaults !== array() ) { foreach ( $defaults as $key => $default_value ) { // @todo should this walk through array subkeys ? $filtered[ $key ] = ( isset( $options[ $key ] ) ? $options[ $key ] : $default_value ); } } */ $filtered = array_merge( $defaults, $options ); return $filtered; }