Update360.php in Lightning Core 8.3
Same filename and directory in other branches
Namespace
Drupal\lightning_core\UpdateFile
src/Update/Update360.phpView source
<?php
namespace Drupal\lightning_core\Update;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Extension\ModuleInstallerInterface;
use Drupal\lightning_core\ConfigHelper as Config;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* @Update("3.6.0")
*/
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'));
}
/**
* @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();
}
}