Skip to content

Commit

Permalink
Move bulk editing to admin service provider
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkamp committed Jan 14, 2025
1 parent ee4b46d commit 5d63bc8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
3 changes: 0 additions & 3 deletions src/Admin/BulkEdit/BulkEditInitializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

namespace Automattic\WooCommerce\GoogleListingsAndAds\Admin\BulkEdit;

use Automattic\WooCommerce\GoogleListingsAndAds\Infrastructure\AdminConditional;
use Automattic\WooCommerce\GoogleListingsAndAds\Infrastructure\Registerable;
use Automattic\WooCommerce\GoogleListingsAndAds\Infrastructure\Service;
use WP_Post;
Expand All @@ -17,8 +16,6 @@
*/
class BulkEditInitializer implements Service, Registerable {

use AdminConditional;

/**
* Register a service.
*/
Expand Down
8 changes: 8 additions & 0 deletions src/Internal/DependencyManagement/AdminServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
namespace Automattic\WooCommerce\GoogleListingsAndAds\Internal\DependencyManagement;

use Automattic\WooCommerce\GoogleListingsAndAds\Admin\Admin;
use Automattic\WooCommerce\GoogleListingsAndAds\Admin\BulkEdit\BulkEditInitializer;
use Automattic\WooCommerce\GoogleListingsAndAds\Admin\BulkEdit\CouponBulkEdit;
use Automattic\WooCommerce\GoogleListingsAndAds\Admin\MetaBox\ChannelVisibilityMetaBox;
use Automattic\WooCommerce\GoogleListingsAndAds\Admin\MetaBox\CouponChannelVisibilityMetaBox;
use Automattic\WooCommerce\GoogleListingsAndAds\Admin\MetaBox\MetaBoxInitializer;
Expand Down Expand Up @@ -51,7 +53,9 @@ class AdminServiceProvider extends AbstractServiceProvider implements Conditiona
protected $provides = [
Admin::class => true,
AttributeMapping::class => true,
BulkEditInitializer::class => true,
ConnectionTest::class => true,
CouponBulkEdit::class => true,
Dashboard::class => true,
GetStarted::class => true,
MetaBoxInterface::class => true,
Expand Down Expand Up @@ -84,6 +88,10 @@ public function register(): void {
$this->share_with_tags( PHPViewFactory::class );
$this->share_with_tags( Redirect::class, WP::class );

Check warning on line 89 in src/Internal/DependencyManagement/AdminServiceProvider.php

View check run for this annotation

Codecov / codecov/patch

src/Internal/DependencyManagement/AdminServiceProvider.php#L80-L89

Added lines #L80 - L89 were not covered by tests

// Share bulk edit views
$this->share_with_tags( CouponBulkEdit::class, CouponMetaHandler::class, MerchantCenterService::class, TargetAudience::class );
$this->share_with_tags( BulkEditInitializer::class );

Check warning on line 93 in src/Internal/DependencyManagement/AdminServiceProvider.php

View check run for this annotation

Codecov / codecov/patch

src/Internal/DependencyManagement/AdminServiceProvider.php#L92-L93

Added lines #L92 - L93 were not covered by tests

// Share admin meta boxes
$this->share_with_tags( ChannelVisibilityMetaBox::class, Admin::class, ProductMetaHandler::class, ProductHelper::class, MerchantCenterService::class );
$this->share_with_tags( CouponChannelVisibilityMetaBox::class, Admin::class, CouponMetaHandler::class, CouponHelper::class, MerchantCenterService::class, TargetAudience::class );
Expand Down
8 changes: 0 additions & 8 deletions src/Internal/DependencyManagement/CoreServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
use Automattic\WooCommerce\Admin\Marketing\MarketingChannels;
use Automattic\WooCommerce\GoogleListingsAndAds\ActionScheduler\ActionScheduler;
use Automattic\WooCommerce\GoogleListingsAndAds\Admin\Admin;
use Automattic\WooCommerce\GoogleListingsAndAds\Admin\BulkEdit\BulkEditInitializer;
use Automattic\WooCommerce\GoogleListingsAndAds\Admin\BulkEdit\CouponBulkEdit;
use Automattic\WooCommerce\GoogleListingsAndAds\Admin\Product\Attributes\AttributesTab;
use Automattic\WooCommerce\GoogleListingsAndAds\Admin\Product\Attributes\VariationsAttributes;
use Automattic\WooCommerce\GoogleListingsAndAds\Admin\Product\ChannelVisibilityBlock;
Expand Down Expand Up @@ -130,11 +128,9 @@ class CoreServiceProvider extends AbstractServiceProvider {
Installer::class => true,
AddressUtility::class => true,
AssetsHandlerInterface::class => true,
BulkEditInitializer::class => true,
ContactInformationNote::class => true,
CompleteSetupTask::class => true,
CompleteSetupNote::class => true,
CouponBulkEdit::class => true,
CouponHelper::class => true,
CouponMetaHandler::class => true,
CouponSyncer::class => true,
Expand Down Expand Up @@ -338,10 +334,6 @@ public function register(): void {
->inflector( TracksAwareInterface::class )
->invokeMethod( 'set_tracks', [ TracksInterface::class ] );

// Share bulk edit views
$this->conditionally_share_with_tags( CouponBulkEdit::class, CouponMetaHandler::class, MerchantCenterService::class, TargetAudience::class );
$this->conditionally_share_with_tags( BulkEditInitializer::class );

// Share other classes.
$this->share_with_tags( ActivatedEvents::class, $_SERVER );
$this->share_with_tags( GenericEvents::class );
Expand Down

0 comments on commit 5d63bc8

Please sign in to comment.