Automattic\WooCommerce\Abilities
ActionableAbility::apply_fields
Write the checked values to the object in memory with the update_callback of each field.
Метод класса: ActionableAbility{}
Хуков нет.
Возвращает
\WP_Error|null. A WP_Error when a callback rejects a value or throws.
Использование
// private - только в коде основоного (родительского) класса $result = $this->apply_fields( $subject, $updates ): ?\WP_Error;
- $subject(WC_Data) (обязательный)
- Object to change.
- $updates(массив) (обязательный)
- Pairs of update_callback and value from prepare_fields().
Код ActionableAbility::apply_fields() ActionableAbility::apply fields WC 11.3.0
private function apply_fields( $subject, array $updates ): ?\WP_Error {
foreach ( $updates as $param => list( $callback, $value ) ) {
$rejected = self::run_callback( $callback, array( $subject, $value ), array( 'field' => $param ) );
if ( null !== $rejected ) {
return $rejected;
}
}
return null;
}