WPSEO_Option::get_switch_key()
Check whether a given array key conforms to one of the variable array key patterns for this option.
Метод класса: WPSEO_Option{}
Хуков нет.
Возвращает
Строку
. Pattern if it conforms, original array key if it doesn't or if the option does not have variable array keys.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_switch_key( $key );
- $key(строка) (обязательный)
- Array key to check.
Код WPSEO_Option::get_switch_key() WPSEO Option::get switch key Yoast 25.0
protected function get_switch_key( $key ) { if ( ! isset( $this->variable_array_key_patterns ) || ( ! is_array( $this->variable_array_key_patterns ) || $this->variable_array_key_patterns === [] ) ) { return $key; } foreach ( $this->variable_array_key_patterns as $pattern ) { if ( strpos( $key, $pattern ) === 0 ) { return $pattern; } } return $key; }