Commit 184e09d5 authored by Tim Diels's avatar Tim Diels
Browse files

Issue #3308083 by Harsh panchal, tim-diels: Phpcs Drupal standard coding issue

parent fe519eba
Loading
Loading
Loading
Loading
+26 −5
Original line number Diff line number Diff line
@@ -21,14 +21,14 @@ class LayoutBuilderBlockDeleteBatch implements ContainerInjectionInterface {
  protected $layoutBuilderBlockDeleteManager;

  /**
   * Constructs a new SanitizerForm object.
   * Constructs a new LayoutBuilderBlockDeleteBatch object.
   */
  public function __construct(LayoutBuilderBlockDeleteManager $layout_builder_block_delete_manager) {
    $this->layoutBuilderBlockDeleteManager = $layout_builder_block_delete_manager;
  }

  /**
   * Create method.
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    return new static(
@@ -38,6 +38,11 @@ class LayoutBuilderBlockDeleteBatch implements ContainerInjectionInterface {

  /**
   * Kick off batch process to delete blocks on all nodes for content types.
   *
   * @param array $content_types
   *   The content types.
   * @param string|null $block_type
   *   The block type.
   */
  public function batchStart(array $content_types, string $block_type = NULL) {
    $nodes = [];
@@ -73,8 +78,14 @@ class LayoutBuilderBlockDeleteBatch implements ContainerInjectionInterface {

  /**
   * Load nodes in batch process progressively to delete all blocks.
   *
   * @param array $data
   *   Additional parameters specific to the batch. These are specified in the
   *   array passed to batch_set().
   * @param array $context
   *   The batch context array, passed by reference.
   */
  public static function batchDeleteAllBlocks(array $data, &$context) {
  public static function batchDeleteAllBlocks(array $data, array &$context) {
    $nids = $data['nids'];

    if (empty($context['sandbox'])) {
@@ -129,10 +140,20 @@ class LayoutBuilderBlockDeleteBatch implements ContainerInjectionInterface {

  /**
   * Callback for batch processing completed.
   *
   * @param bool $success
   *   A boolean indicating whether the batch has completed successfully.
   * @param array $results
   *   The value set in $context['results'] by callback_batch_operation().
   * @param array $operations
   *   If $success is FALSE, contains the operations that remained unprocessed.
   * @param string $elapsed
   *   A string representing the elapsed time for the batch process, e.g.,
   *   '1 min 30 secs'.
   */
  public static function batchCompleted($success, $results, $operations) {
  public static function batchCompleted(bool $success, array $results, array $operations, string $elapsed) {
    $messenger = \Drupal::messenger();
    if ($success == TRUE) {
    if ($success) {
      $messenger->addMessage(t('@count nodes were processed.', [
        '@count' => count($results),
      ]));
+16 −1
Original line number Diff line number Diff line
@@ -84,6 +84,16 @@ class LayoutBuilderBlockDeleteManager implements ContainerInjectionInterface {
  /**
   * Constructs a new LayoutBuilderBlockSanitizerManager object.
   *
   * @param \Drupal\block_content\BlockContentUuidLookup $block_content_uuid_lookup
   *   The block content uuid lookup.
   * @param \Drupal\layout_builder\SectionStorage\SectionStorageManager $plugin_manager_layout_builder_section_storage
   *   The plugin manager layout builder section storage.
   * @param \Drupal\layout_builder\LayoutTempstoreRepository $layout_builder_tempstore_repository
   *   The layout builder tempstore repository.
   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
   *   The entity type manager.
   * @param \Drupal\Core\Messenger\MessengerInterface $messenger
   *   The messenger.
   * @param \Symfony\Contracts\EventDispatcher\EventDispatcherInterface $event_dispatcher
   *   The event dispatcher.
   * @param \Drupal\Core\Logger\LoggerChannelFactoryInterface $logger_factory
@@ -103,7 +113,7 @@ class LayoutBuilderBlockDeleteManager implements ContainerInjectionInterface {
  }

  /**
   * Create method.
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    return new static(
@@ -189,6 +199,11 @@ class LayoutBuilderBlockDeleteManager implements ContainerInjectionInterface {

  /**
   * Delete all blocks for a node.
   *
   * @param int $nid
   *   The node ID.
   * @param string|null $block_type
   *   The block type.
   */
  public function deleteBlocks(int $nid, string $block_type = NULL) {
    try {
+1 −1

File changed.

Contains only whitespace changes.