You are here

final class Update360 in Lightning Core 8.5

Same name and namespace in other branches
  1. 8.3 src/Update/Update360.php \Drupal\lightning_core\Update\Update360
  2. 8.4 src/Update/Update360.php \Drupal\lightning_core\Update\Update360

Contains optional configuration updates targeting Lightning Core 3.6.0.

Plugin annotation

@Update("3.6.0");

Hierarchy

Expanded class hierarchy of Update360

1 file declares its use of Update360
Update360Test.php in tests/src/Kernel/Update/Update360Test.php

File

src/Update/Update360.php, line 15

Namespace

Drupal\lightning_core\Update
View source
final class Update360 implements ContainerInjectionInterface {

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

  /**
   * Update360 constructor.
   *
   * @param \Drupal\Core\Extension\ModuleInstallerInterface $module_installer
   *   The module installer service.
   */
  public function __construct(ModuleInstallerInterface $module_installer) {
    $this->moduleInstaller = $module_installer;
  }

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

  /**
   * Enables avatars for user accounts.
   *
   * @update
   *
   * @ask Do you want to enable pictures for user accounts?
   */
  public function enableUserPictures() {
    $this->moduleInstaller
      ->install([
      'image',
    ]);
    $config = Config::forModule('lightning_core')
      ->optional();
    $config
      ->getEntity('field_storage_config', 'user.user_picture')
      ->save();
    $config
      ->getEntity('field_config', 'user.user.user_picture')
      ->save();
    $config
      ->getEntity('entity_view_display', 'user.user.compact')
      ->save();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Update360::$moduleInstaller private property The module installer service.
Update360::create public static function Instantiates a new instance of this class. Overrides ContainerInjectionInterface::create
Update360::enableUserPictures public function Enables avatars for user accounts.
Update360::__construct public function Update360 constructor.