Commit bdbbb046 authored by Adam G-H's avatar Adam G-H
Browse files

Issue #3279527 by phenaproxima, tedbow: Ensure plugins are reloaded after an update

parent dae56200
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
<?php

namespace Drupal\updated_module\Plugin\Block;

use Drupal\Core\Block\BlockBase;

/**
 * This block is removed from version 1.1.0 of this module.
 *
 * @Block(
 *   id = "updated_module_deleted_block",
 *   admin_label = @Translation("Deleted block"),
 * )
 */
class DeletedBlock extends BlockBase {

  /**
   * {@inheritdoc}
   */
  public function build() {
    return [
      '#markup' => $this->t('Goodbye!'),
    ];
  }

}
+29 −0
Original line number Diff line number Diff line
<?php

namespace Drupal\updated_module\Plugin\Block;

use Drupal\Core\Block\BlockBase;

/**
 * Defines a block plugin to test plugin reloading during an update.
 *
 * This block should NOT be loaded before updating to version 1.1.0 of this
 * module.
 *
 * @Block(
 *   id = "updated_module_ignored_block",
 *   admin_label = @Translation("1.0.0")
 * )
 */
class IgnoredBlock extends BlockBase {

  /**
   * {@inheritdoc}
   */
  public function build() {
    return [
      '#markup' => $this->t("I should not be instantiated before the update."),
    ];
  }

}
+29 −0
Original line number Diff line number Diff line
<?php

namespace Drupal\updated_module\Plugin\Block;

use Drupal\Core\Block\BlockBase;

/**
 * Defines a block plugin to test plugin reloading during an update.
 *
 * In version 1.1.0 of this module, this block exists but its plugin definition
 * and implementation are different.
 *
 * @Block(
 *   id = "updated_module_updated_block",
 *   admin_label = @Translation("1.0.0")
 * )
 */
class UpdatedBlock extends BlockBase {

  /**
   * {@inheritdoc}
   */
  public function build() {
    return [
      '#markup' => $this->t('1.0.0'),
    ];
  }

}
+26 −0
Original line number Diff line number Diff line
<?php

namespace Drupal\updated_module\Plugin\Block;

use Drupal\Core\Block\BlockBase;

/**
 * This block doesn't exist in version 1.0.0 of this module.
 *
 * @Block(
 *   id = "updated_module_added_block",
 *   admin_label = @Translation("Added block"),
 * )
 */
class AddedBlock extends BlockBase {

  /**
   * {@inheritdoc}
   */
  public function build() {
    return [
      '#markup' => $this->t('Hello!'),
    ];
  }

}
+29 −0
Original line number Diff line number Diff line
<?php

namespace Drupal\updated_module\Plugin\Block;

use Drupal\Core\Block\BlockBase;

/**
 * Defines a block plugin to test plugin reloading during an update.
 *
 * This block should only be loaded and built after updating to version 1.1.0 of
 * this module.
 *
 * @Block(
 *   id = "updated_module_ignored_block",
 *   admin_label = @Translation("1.1.0")
 * )
 */
class IgnoredBlock extends BlockBase {

  /**
   * {@inheritdoc}
   */
  public function build() {
    return [
      '#markup' => $this->t('I was ignored before the update.'),
    ];
  }

}
Loading