WC_Shortcode_Products::parse_legacy_attributes
Parse legacy attributes.
Метод класса: WC_Shortcode_Products{}
Хуков нет.
Возвращает
Массив.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->parse_legacy_attributes( $attributes );
- $attributes(массив) (обязательный)
- Attributes.
Список изменений
| С версии 3.2.0 | Введена. |
Код WC_Shortcode_Products::parse_legacy_attributes() WC Shortcode Products::parse legacy attributes WC 10.7.0
protected function parse_legacy_attributes( $attributes ) {
$mapping = array(
'per_page' => 'limit',
'operator' => 'cat_operator',
'filter' => 'terms',
);
foreach ( $mapping as $old => $new ) {
if ( isset( $attributes[ $old ] ) ) {
$attributes[ $new ] = $attributes[ $old ];
unset( $attributes[ $old ] );
}
}
return $attributes;
}