Automattic\WooCommerce\Blueprint
ImportStep::can_import
Check if the step can be imported.
Метод класса: ImportStep{}
Хуков нет.
Возвращает
true|false
. True if the step can be imported, false otherwise.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->can_import( $result );
- $result(StepProcessorResult) (обязательный) (передается по ссылке — &)
- The result object to add messages to.
Код ImportStep::can_import() ImportStep::can import WC 10.0.2
protected function can_import( &$result ) { // Check if the importer exists. if ( ! isset( $this->indexed_importers[ $this->step_definition->step ] ) ) { $result->add_error( 'Unable to find an importer' ); return false; } $importer = $this->indexed_importers[ $this->step_definition->step ]; // Validate importer is a step processor before processing. if ( ! $importer instanceof StepProcessor ) { $result->add_error( 'Incorrect importer type' ); return false; } // Validate steps schemas before processing. if ( ! $this->validate_step_schemas( $importer, $result ) ) { $result->add_error( 'Schema validation failed for step' ); return false; } // Validate step capabilities before processing. if ( ! $importer->check_step_capabilities( $this->step_definition ) ) { $result->add_error( 'User does not have the required capabilities to run step' ); return false; } return true; }