You are here

final class Update310 in Lightning Workflow 8.3

Contains optional updates targeting Lightning Workflow 3.1.0.

Plugin annotation

@Update("3.1.0");

Hierarchy

Expanded class hierarchy of Update310

File

src/Update/Update310.php, line 17

Namespace

Drupal\lightning_workflow\Update
View source
final class Update310 implements ContainerInjectionInterface {
  use StringTranslationTrait;

  /**
   * The module installer.
   *
   * @var \Drupal\Core\Extension\ModuleInstallerInterface
   */
  private $moduleInstaller;

  /**
   * The config factory service.
   *
   * @var \Drupal\Core\Config\ConfigFactoryInterface
   */
  private $configFactory;

  /**
   * Update310 constructor.
   *
   * @param \Drupal\Core\Extension\ModuleInstallerInterface $module_installer
   *   The module installer.
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
   *   The config factory service.
   */
  public function __construct(ModuleInstallerInterface $module_installer, ConfigFactoryInterface $config_factory) {
    $this->moduleInstaller = $module_installer;
    $this->configFactory = $config_factory;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    return new static($container
      ->get('module_installer'), $container
      ->get('config.factory'));
  }

  /**
   * Enables the Moderation Dashboard module.
   *
   * @param \Symfony\Component\Console\Style\StyleInterface $io
   *   The I/O handler.
   *
   * @update
   *
   * @ask Do you want to enable the Moderation Dashboard module?
   */
  public function enableModerationDashboard(StyleInterface $io) {
    $installed = $this->moduleInstaller
      ->install([
      'moderation_dashboard',
    ]);
    if ($installed) {
      $question = (string) $this
        ->t('Do you want users with the appropriate permissions to be redirected to the moderation dashboard when they log in?');
      $this->configFactory
        ->getEditable('moderation_dashboard.settings')
        ->set('redirect_on_login', $io
        ->confirm($question, FALSE))
        ->save();
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.
Update310::$configFactory private property The config factory service.
Update310::$moduleInstaller private property The module installer.
Update310::create public static function Instantiates a new instance of this class. Overrides ContainerInjectionInterface::create
Update310::enableModerationDashboard public function Enables the Moderation Dashboard module.
Update310::__construct public function Update310 constructor.