Automattic\WooCommerce\Abilities
ActionableAbility::validate
Run the validators of the resource on the changed object.
Method of the class: ActionableAbility{}
No Hooks.
Returns
\WP_Error|null. A WP_Error when a validator refuses the change.
Usage
// private - for code of main (parent) class only $result = $this->validate( $subject ): ?\WP_Error;
- $subject(WC_Data) (required)
- Changed object.
ActionableAbility::validate() ActionableAbility::validate code WC 11.3.0
private function validate( $subject ): ?\WP_Error {
foreach ( ExtensibleAbilities::get_validators( $this->get_resource() ) as $args ) {
$rejected = self::run_callback( $args['callback'], array( $subject, $this ), array( 'namespace' => $args['namespace'] ) );
if ( null !== $rejected ) {
return $rejected;
}
}
return null;
}