Automattic\WooCommerce\Admin\Features\ProductBlockEditor
ProductFormsController::migrate_templates_when_plugin_updated
Migrate form templates after WooCommerce plugin update.
Метод класса: ProductFormsController{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$ProductFormsController = new ProductFormsController(); $ProductFormsController->migrate_templates_when_plugin_updated( $upgrader, $hook_extra );
- $upgrader(WP_Upgrader) (обязательный)
- The WP_Upgrader instance.
- $hook_extra(массив) (обязательный)
- Extra arguments passed to hooked filters.
Код ProductFormsController::migrate_templates_when_plugin_updated() ProductFormsController::migrate templates when plugin updated WC 10.7.0
public function migrate_templates_when_plugin_updated( \WP_Upgrader $upgrader, array $hook_extra ) {
// If it is not a plugin hook type, bail early.
$type = isset( $hook_extra['type'] ) ? $hook_extra['type'] : '';
if ( 'plugin' !== $type ) {
return;
}
// If it is not the WooCommerce plugin, bail early.
$plugins = isset( $hook_extra['plugins'] ) ? $hook_extra['plugins'] : array();
if (
! in_array( 'woocommerce/woocommerce.php', $plugins, true )
) {
return;
}
// If the action is not install or update, bail early.
$action = isset( $hook_extra['action'] ) ? $hook_extra['action'] : '';
if ( 'install' !== $action && 'update' !== $action ) {
return;
}
// Trigger the migration process.
$this->migrate_product_form_posts( $action );
}