Automattic\WooCommerce\Internal\Features
FeaturesController::get_feature_definitions() │ private │ WC 1.0
Generate and cache the feature definitions.
Метод класса: FeaturesController{}
Хуки из метода
Возвращает
Массив[]
.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_feature_definitions();
Код FeaturesController::get_feature_definitions() FeaturesController::get feature definitions WC 9.5.1
private function get_feature_definitions() { if ( empty( $this->features ) ) { $legacy_features = array( 'analytics' => array( 'name' => __( 'Analytics', 'woocommerce' ), 'description' => __( 'Enable WooCommerce Analytics', 'woocommerce' ), 'option_key' => Analytics::TOGGLE_OPTION_NAME, 'is_experimental' => false, 'enabled_by_default' => true, 'disable_ui' => false, 'is_legacy' => true, ), 'product_block_editor' => array( 'name' => __( 'New product editor', 'woocommerce' ), 'description' => __( 'Try the new product editor (Beta)', 'woocommerce' ), 'is_experimental' => true, 'disable_ui' => false, 'is_legacy' => true, 'disabled' => function () { return version_compare( get_bloginfo( 'version' ), '6.2', '<' ); }, 'desc_tip' => function () { $string = ''; if ( version_compare( get_bloginfo( 'version' ), '6.2', '<' ) ) { $string = __( '⚠ This feature is compatible with WordPress version 6.2 or higher.', 'woocommerce' ); } return $string; }, ), 'cart_checkout_blocks' => array( 'name' => __( 'Cart & Checkout Blocks', 'woocommerce' ), 'description' => __( 'Optimize for faster checkout', 'woocommerce' ), 'is_experimental' => false, 'disable_ui' => true, ), 'marketplace' => array( 'name' => __( 'Marketplace', 'woocommerce' ), 'description' => __( 'New, faster way to find extensions and themes for your WooCommerce store', 'woocommerce' ), 'is_experimental' => false, 'enabled_by_default' => true, 'disable_ui' => true, 'is_legacy' => true, ), // Marked as a legacy feature to avoid compatibility checks, which aren't really relevant to this feature. // https://github.com/woocommerce/woocommerce/pull/39701#discussion_r1376976959. 'order_attribution' => array( 'name' => __( 'Order Attribution', 'woocommerce' ), 'description' => __( 'Enable this feature to track and credit channels and campaigns that contribute to orders on your site', 'woocommerce' ), 'enabled_by_default' => true, 'disable_ui' => false, 'is_legacy' => true, 'is_experimental' => false, ), 'site_visibility_badge' => array( 'name' => __( 'Site visibility badge', 'woocommerce' ), 'description' => __( 'Enable the site visibility badge in the WordPress admin bar', 'woocommerce' ), 'enabled_by_default' => true, 'disable_ui' => false, 'is_legacy' => true, 'is_experimental' => false, 'disabled' => false, ), 'hpos_fts_indexes' => array( 'name' => __( 'HPOS Full text search indexes', 'woocommerce' ), 'description' => __( 'Create and use full text search indexes for orders. This feature only works with high-performance order storage.', 'woocommerce' ), 'is_experimental' => true, 'enabled_by_default' => false, 'is_legacy' => true, 'option_key' => CustomOrdersTableController::HPOS_FTS_INDEX_OPTION, ), 'remote_logging' => array( 'name' => __( 'Remote Logging', 'woocommerce' ), 'description' => __( 'Enable this feature to log errors and related data to Automattic servers for debugging purposes and to improve WooCommerce', 'woocommerce' ), 'enabled_by_default' => true, 'disable_ui' => true, 'is_legacy' => false, 'is_experimental' => true, ), 'email_improvements' => array( 'name' => __( 'Email improvements', 'woocommerce' ), 'description' => __( 'Enable modern email design and live preview for transactional emails', 'woocommerce' ), 'disable_ui' => true, ), ); foreach ( $legacy_features as $slug => $definition ) { $this->add_feature_definition( $slug, $definition['name'], $definition ); } /** * The action for registering features. * * @since 8.3.0 * * @param FeaturesController $features_controller The instance of FeaturesController. */ do_action( 'woocommerce_register_feature_definitions', $this ); foreach ( array_keys( $this->features ) as $feature_id ) { $this->compatibility_info_by_feature[ $feature_id ] = array( 'compatible' => array(), 'incompatible' => array(), ); } } return $this->features; }