Automattic\WooCommerce\Internal\Features

FeaturesController::get_feature_definitionsprivateWC 1.0

Generate and cache the feature definitions.

Method of the class: FeaturesController{}

No Hooks.

Returns

Array[].

Usage

// private - for code of main (parent) class only
$result = $this->get_feature_definitions();

FeaturesController::get_feature_definitions() code WC 10.3.5

private function get_feature_definitions() {
	if ( empty( $this->features ) ) {
		$this->init_feature_definitions();
	}

	if ( ! $this->registered_additional_features_via_class_calls ) {
		// This needs to be set to true *before* additional feature definition calls are made,
		// to prevent infinite loops in case one of these calls ends up calling here again.
		$this->registered_additional_features_via_class_calls = true;

		// Additional feature definitions.
		// These used to be tied to the now deprecated woocommerce_register_feature_definitions action,
		// and aren't processed in init_feature_definitions to avoid circular calls in the dependency injection container.
		$container = wc_get_container();
		$container->get( CustomOrdersTableController::class )->add_feature_definition( $this );
		$container->get( CostOfGoodsSoldController::class )->add_feature_definition( $this );

		$this->init_compatibility_info_by_feature();
	}

	return $this->features;
}