Commit d8c718b2 authored by alexpott's avatar alexpott

Revert "Issue #2210197 by sun, longwave: Remove public access to...

Revert "Issue #2210197 by sun, longwave: Remove public access to Extension::$type, ::$name, ::$filename." Broke 'drush en simpletest' on testbots

This reverts commit 2c51074d.
parent 0aa59382
......@@ -850,7 +850,7 @@ function install_tasks($install_state) {
// Load the profile install file, because it is not always loaded when
// hook_install_tasks() is invoked (e.g. batch processing).
$profile = $install_state['parameters']['profile'];
$profile_install_file = $install_state['profiles'][$profile]->getPath() . '/' . $profile . '.install';
$profile_install_file = dirname($install_state['profiles'][$profile]->uri) . '/' . $profile . '.install';
if (file_exists($profile_install_file)) {
include_once DRUPAL_ROOT . '/' . $profile_install_file;
}
......@@ -1371,19 +1371,19 @@ function _install_select_profile($profiles) {
$request_params = \Drupal::request()->request;
if (count($profiles) == 1) {
$profile = array_pop($profiles);
return $profile->getName();
return $profile->name;
}
elseif ($request_params->has('profile') && ($profile = $request_params->get('profile')) && isset($profiles[$profile])) {
return $profiles[$profile]->getName();
return $profiles[$profile]->name;
}
// Check for a profile marked as "exclusive" and ensure that only one
// profile is marked as such.
$exclusive_profile = NULL;
foreach ($profiles as $profile) {
$profile_info = install_profile_info($profile->getName());
$profile_info = install_profile_info($profile->name);
if (!empty($profile_info['exclusive'])) {
if (empty($exclusive_profile)) {
$exclusive_profile = $profile->getName();
$exclusive_profile = $profile->name;
}
else {
// We found a second "exclusive" profile. There's no way to choose
......@@ -1409,7 +1409,7 @@ function install_select_profile_form($form, &$form_state, $install_state) {
$profiles = array();
$names = array();
foreach ($install_state['profiles'] as $profile) {
$details = install_profile_info($profile->getName());
$details = install_profile_info($profile->name);
// Skip this extension if its type is not profile.
if (!isset($details['type']) || $details['type'] != 'profile') {
continue;
......@@ -1419,12 +1419,12 @@ function install_select_profile_form($form, &$form_state, $install_state) {
if ($details['hidden'] === TRUE) {
continue;
}
$profiles[$profile->getName()] = $details;
$profiles[$profile->name] = $details;
// Determine the name of the profile; default to file name if defined name
// is unspecified.
$name = isset($details['name']) ? $details['name'] : $profile->getName();
$names[$profile->getName()] = $name;
$name = isset($details['name']) ? $details['name'] : $profile->name;
$names[$profile->name] = $name;
}
// Display radio buttons alphabetically by human-readable name, but always
......
......@@ -573,7 +573,9 @@ function drupal_verify_profile($install_state) {
include_once __DIR__ . '/common.inc';
$profile = $install_state['parameters']['profile'];
if (!isset($profile) || !isset($install_state['profiles'][$profile])) {
$profile_file = $install_state['profiles'][$profile]->uri;
if (!isset($profile) || !file_exists($profile_file)) {
throw new Exception(install_no_profile_error());
}
$info = $install_state['profile_info'];
......@@ -582,7 +584,7 @@ function drupal_verify_profile($install_state) {
$listing = new ExtensionDiscovery();
$present_modules = array();
foreach ($listing->scan('module') as $present_module) {
$present_modules[] = $present_module->getName();
$present_modules[] = $present_module->name;
}
// The installation profile is also a module, which needs to be installed
......
......@@ -63,7 +63,7 @@ function system_list($type) {
$lists['filepaths'][] = array(
'type' => 'theme',
'name' => $name,
'filepath' => $theme->getPathname(),
'filepath' => $theme->filename,
);
}
}
......
......@@ -79,7 +79,7 @@
*/
function drupal_theme_access($theme) {
if ($theme instanceof Extension) {
$theme = $theme->getName();
$theme = $theme->name;
}
return \Drupal::service('access_check.theme')->checkAccess($theme);
}
......@@ -135,7 +135,7 @@ function _drupal_theme_initialize($theme, $base_theme = array()) {
$theme_info = $theme;
$base_theme_info = $base_theme;
$theme_path = $theme->getPath();
$theme_path = dirname($theme->filename);
// Prepare stylesheets from this theme as well as all ancestor themes.
// We work it this way so that we can have child themes override parent
......@@ -155,7 +155,7 @@ function _drupal_theme_initialize($theme, $base_theme = array()) {
}
}
}
$base_theme_path = $base->getPath();
$base_theme_path = dirname($base->filename);
if (!empty($base->info['stylesheets-remove'])) {
foreach ($base->info['stylesheets-remove'] as $basename) {
$theme->stylesheets_remove[$basename] = $base_theme_path . '/' . $basename;
......@@ -793,7 +793,7 @@ function drupal_find_theme_templates($cache, $extension, $path) {
$theme_paths = array();
foreach (list_themes() as $theme_info) {
if (!empty($theme_info->base_theme)) {
$theme_paths[$theme_info->base_theme][$theme_info->getName()] = $theme_info->getPath();
$theme_paths[$theme_info->base_theme][$theme_info->name] = dirname($theme_info->filename);
}
}
foreach ($theme_paths as $basetheme => $subthemes) {
......@@ -955,7 +955,7 @@ function theme_get_setting($setting_name, $theme = NULL) {
if ($cache[$theme]->get('features.logo')) {
$logo_path = $cache[$theme]->get('logo.path');
if ($cache[$theme]->get('logo.use_default')) {
$cache[$theme]->set('logo.url', file_create_url($theme_object->getPath() . '/logo.png'));
$cache[$theme]->set('logo.url', file_create_url(dirname($theme_object->filename) . '/logo.png'));
}
elseif ($logo_path) {
$cache[$theme]->set('logo.url', file_create_url($logo_path));
......@@ -966,7 +966,7 @@ function theme_get_setting($setting_name, $theme = NULL) {
if ($cache[$theme]->get('features.favicon')) {
$favicon_path = $cache[$theme]->get('favicon.path');
if ($cache[$theme]->get('favicon.use_default')) {
if (file_exists($favicon = $theme_object->getPath() . '/favicon.ico')) {
if (file_exists($favicon = dirname($theme_object->filename) . '/favicon.ico')) {
$cache[$theme]->set('favicon.url', file_create_url($favicon));
}
else {
......
......@@ -290,8 +290,10 @@ public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQ
* @param $module
* The name of the module.
*
* @return \Drupal\Core\Extension\Extension|bool
* Returns an Extension object if the module is found, FALSE otherwise.
* @return \stdClass|bool
* Returns a stdClass object if the module data is found containing at
* least an uri property with the module path, for example
* core/modules/user/user.module.
*/
protected function moduleData($module) {
if (!$this->moduleData) {
......
......@@ -15,9 +15,11 @@ class Extension implements \Serializable {
/**
* The type of the extension (e.g., 'module').
*
* @todo Replace all uses of $type with getType() method.
*
* @var string
*/
protected $type;
public $type;
/**
* The relative pathname of the extension (e.g., 'core/modules/node/node.info.yml').
......@@ -26,6 +28,15 @@ class Extension implements \Serializable {
*/
protected $pathname;
/**
* The internal name of the extension (e.g., 'node').
*
* @todo Replace all uses of $name with getName() method.
*
* @var string
*/
public $name;
/**
* The relative pathname of the main extension file (e.g., 'core/modules/node/node.module').
*
......@@ -39,9 +50,21 @@ class Extension implements \Serializable {
/**
* The filename of the main extension file (e.g., 'node.module').
*
* Note that this is not necessarily a filename but a pathname and also not
* necessarily the filename of the info file. Due to legacy code and property
* value overloading, it is either the filename of the main extension file or
* the relative pathname of the main extension file (== $uri), depending on
* whether the object has been post-processed or not.
*
* @see _system_rebuild_module_data()
* @see \Drupal\Core\Extension\ThemeHandler::rebuildThemeData()
*
* @todo Remove this property and do not require .module/.profile files.
* @see https://drupal.org/node/340723
*
* @var string
*/
protected $filename;
public $filename;
/**
* An SplFileInfo instance for the extension's info file.
......@@ -67,6 +90,7 @@ public function __construct($type, $pathname, $filename) {
$this->type = $type;
$this->pathname = $pathname;
// Set legacy public properties.
$this->name = basename($pathname, '.info.yml');
$this->filename = $filename;
$this->uri = dirname($pathname) . '/' . $filename;
}
......@@ -183,6 +207,7 @@ public function unserialize($data) {
// @todo Remove these properties and do not require .module/.profile files.
// @see https://drupal.org/node/340723
// @see Extension::$filename
$this->name = basename($data['pathname'], '.info.yml');
$this->uri = dirname($data['pathname']) . '/' . $data['filename'];
$this->filename = $data['filename'];
......
......@@ -278,14 +278,14 @@ protected function process(array $all_files) {
// e.g. new modules were introduced in core while older contrib modules with
// the same name still exist in a later search path.
foreach ($all_files as $file) {
if (isset($files[$file->getName()])) {
if (isset($files[$file->name])) {
// Skip the extension if it is incompatible with Drupal core.
$info = $this->getInfoParser()->parse($file->getPathname());
if (!isset($info['core']) || $info['core'] != \Drupal::CORE_COMPATIBILITY) {
continue;
}
}
$files[$file->getName()] = $file;
$files[$file->name] = $file;
}
return $files;
}
......@@ -366,12 +366,16 @@ protected function scanDirectory($dir, $include_tests) {
$name = $fileinfo->getBasename('.info.yml');
$pathname = $dir_prefix . $fileinfo->getSubPathname();
// Determine whether the extension has a main extension file.
// Supply main extension filename being used throughout Drupal.
// For themes, the filename is the info file itself.
if ($type == 'theme') {
$filename = $fileinfo->getFilename();
}
// For theme engines, the file extension is .engine.
if ($type == 'theme_engine') {
elseif ($type == 'theme_engine') {
$filename = $name . '.engine';
}
// For profiles/modules/themes, it is the extension type.
// Otherwise, it is .module/.profile; i.e., the extension type.
else {
$filename = $name . '.' . $type;
}
......
......@@ -145,11 +145,11 @@ public function setModuleList(array $module_list = array()) {
*/
public function buildModuleDependencies(array $modules) {
foreach ($modules as $module) {
$graph[$module->getName()]['edges'] = array();
$graph[$module->name]['edges'] = array();
if (isset($module->info['dependencies']) && is_array($module->info['dependencies'])) {
foreach ($module->info['dependencies'] as $dependency) {
$dependency_data = static::parseDependency($dependency);
$graph[$module->getName()]['edges'][$dependency_data['name']] = $dependency_data;
$graph[$module->name]['edges'][$dependency_data['name']] = $dependency_data;
}
}
}
......@@ -382,7 +382,7 @@ public function alter($type, &$data, &$context1 = NULL, &$context2 = NULL) {
if (isset($theme)) {
$theme_keys = array();
foreach ($base_theme_info as $base) {
$theme_keys[] = $base->getName();
$theme_keys[] = $base->name;
}
$theme_keys[] = $theme;
foreach ($theme_keys as $theme_key) {
......
......@@ -220,7 +220,7 @@ public function listInfo() {
if (!isset($theme->status)) {
$theme->status = 0;
}
$this->list[$theme->getName()] = $theme;
$this->list[$theme->name] = $theme;
}
}
return $this->list;
......@@ -271,6 +271,7 @@ public function rebuildThemeData() {
$sub_themes = array();
// Read info files for each theme.
foreach ($themes as $key => $theme) {
$theme->filename = $theme->uri;
$theme->info = $this->infoParser->parse($theme->getPathname()) + $defaults;
// Add the info file modification time, so it becomes available for
......@@ -291,7 +292,7 @@ public function rebuildThemeData() {
$engine = $theme->info['engine'];
if (isset($engines[$engine])) {
$theme->owner = $engines[$engine]->uri;
$theme->prefix = $engines[$engine]->getName();
$theme->prefix = $engines[$engine]->name;
}
// Prefix stylesheets, scripts, and screenshot with theme path.
......
......@@ -39,16 +39,13 @@ public function __construct(\Twig_LoaderInterface $loader = NULL, $options = arr
$this->cache_object = \Drupal::cache();
// Set twig path namespace for themes and modules.
$namespaces = array();
foreach ($module_handler->getModuleList() as $name => $filename) {
$namespaces[$name] = dirname($filename);
}
foreach ($theme_handler->listInfo() as $name => $extension) {
$namespaces[$name] = $extension->getPath();
$namespaces = $module_handler->getModuleList();
foreach ($theme_handler->listInfo() as $theme => $info) {
$namespaces[$theme] = $info->filename;
}
foreach ($namespaces as $name => $path) {
$templatesDirectory = $path . '/templates';
foreach ($namespaces as $name => $filename) {
$templatesDirectory = dirname($filename) . '/templates';
if (file_exists($templatesDirectory)) {
$loader->addPath($templatesDirectory, $name);
}
......
......@@ -154,7 +154,7 @@ protected function init($theme_name = NULL) {
}
// #2: The testing framework only cares for the global $theme variable at
// this point. Cope with that.
if ($GLOBALS['theme'] != $GLOBALS['theme_info']->getName()) {
if ($GLOBALS['theme'] != $GLOBALS['theme_info']->name) {
unset($this->runtimeRegistry);
unset($this->registry);
$this->initializeTheme();
......@@ -207,7 +207,7 @@ public function get() {
if (isset($this->registry)) {
return $this->registry;
}
if ($cache = $this->cache->get('theme_registry:' . $this->theme->getName())) {
if ($cache = $this->cache->get('theme_registry:' . $this->theme->name)) {
$this->registry = $cache->data;
}
else {
......@@ -230,7 +230,7 @@ public function get() {
*/
public function getRuntime() {
if (!isset($this->runtimeRegistry)) {
$this->runtimeRegistry = new ThemeRegistry('theme_registry:runtime:' . $this->theme->getName(), $this->cache, $this->lock, array('theme_registry' => TRUE), $this->moduleHandler->isLoaded());
$this->runtimeRegistry = new ThemeRegistry('theme_registry:runtime:' . $this->theme->name, $this->cache, $this->lock, array('theme_registry' => TRUE), $this->moduleHandler->isLoaded());
}
return $this->runtimeRegistry;
}
......@@ -239,7 +239,7 @@ public function getRuntime() {
* Persists the theme registry in the cache backend.
*/
protected function setCache() {
$this->cache->set('theme_registry:' . $this->theme->getName(), $this->registry, Cache::PERMANENT, array('theme_registry' => TRUE));
$this->cache->set('theme_registry:' . $this->theme->name, $this->registry, Cache::PERMANENT, array('theme_registry' => TRUE));
}
/**
......@@ -319,20 +319,20 @@ protected function build() {
// Process each base theme.
foreach ($this->baseThemes as $base) {
// If the base theme uses a theme engine, process its hooks.
$base_path = $base->getPath();
$base_path = dirname($base->filename);
if ($this->engine) {
$this->processExtension($cache, $this->engine, 'base_theme_engine', $base->getName(), $base_path);
$this->processExtension($cache, $this->engine, 'base_theme_engine', $base->name, $base_path);
}
$this->processExtension($cache, $base->getName(), 'base_theme', $base->getName(), $base_path);
$this->processExtension($cache, $base->name, 'base_theme', $base->name, $base_path);
}
// And then the same thing, but for the theme.
if ($this->engine) {
$this->processExtension($cache, $this->engine, 'theme_engine', $this->theme->getName(), $this->theme->getPath());
$this->processExtension($cache, $this->engine, 'theme_engine', $this->theme->name, dirname($this->theme->filename));
}
// Finally, hooks provided by the theme itself.
$this->processExtension($cache, $this->theme->getName(), 'theme', $this->theme->getName(), $this->theme->getPath());
$this->processExtension($cache, $this->theme->name, 'theme', $this->theme->name, dirname($this->theme->filename));
// Let modules alter the registry.
$this->moduleHandler->alter('theme_registry', $cache);
......
......@@ -9,8 +9,6 @@
namespace Drupal\Core\Utility;
use Drupal\Core\Extension\Extension;
/**
* Performs operations on drupal.org project data.
*/
......@@ -96,7 +94,8 @@ function processInfoList(array &$projects, array $list, $project_type, $status,
// which is left alone by tar and correctly set to the time the .info.yml
// file was unpacked.
if (!isset($file->info['_info_file_ctime'])) {
$file->info['_info_file_ctime'] = $file->getCTime();
$info_filename = dirname($file->uri) . '/' . $file->name . '.info.yml';
$file->info['_info_file_ctime'] = filectime($info_filename);
}
if (!isset($file->info['datestamp'])) {
......@@ -143,7 +142,7 @@ function processInfoList(array &$projects, array $list, $project_type, $status,
// not bloat our RAM usage needlessly.
'info' => $this->filterProjectInfo($file->info, $additional_whitelist),
'datestamp' => $file->info['datestamp'],
'includes' => array($file->getName() => $file->info['name']),
'includes' => array($file->name => $file->info['name']),
'project_type' => $project_display_type,
'project_status' => $status,
'sub_themes' => $sub_themes,
......@@ -156,7 +155,7 @@ function processInfoList(array &$projects, array $list, $project_type, $status,
// $project_display_type). This prevents listing all the disabled
// modules included with an enabled project if we happen to be checking
// for disabled modules, too.
$projects[$project_name]['includes'][$file->getName()] = $file->info['name'];
$projects[$project_name]['includes'][$file->name] = $file->info['name'];
$projects[$project_name]['info']['_info_file_ctime'] = max($projects[$project_name]['info']['_info_file_ctime'], $file->info['_info_file_ctime']);
$projects[$project_name]['datestamp'] = max($projects[$project_name]['datestamp'], $file->info['datestamp']);
if (!empty($sub_themes)) {
......@@ -171,7 +170,7 @@ function processInfoList(array &$projects, array $list, $project_type, $status,
// does not, it means we're processing a disabled module or theme that
// belongs to a project that has some enabled code. In this case, we add
// the disabled thing into a separate array for separate display.
$projects[$project_name]['disabled'][$file->getName()] = $file->info['name'];
$projects[$project_name]['disabled'][$file->name] = $file->info['name'];
}
}
}
......@@ -185,12 +184,12 @@ function processInfoList(array &$projects, array $list, $project_type, $status,
* @return string
* The canonical project short name.
*/
function getProjectName(Extension $file) {
function getProjectName($file) {
$project_name = '';
if (isset($file->info['project'])) {
$project_name = $file->info['project'];
}
elseif (strpos($file->getPath(), 'core/modules') === 0) {
elseif (isset($file->filename) && (strpos($file->filename, 'core/modules') === 0)) {
$project_name = 'drupal';
}
return $project_name;
......
......@@ -72,7 +72,7 @@ public function __construct(CacheBackendInterface $cache_backend, LanguageManage
$directories[$module] = dirname($filename);
}
foreach ($theme_handler->listInfo() as $theme) {
$directories[$theme->getName()] = $theme->getPath();
$directories[$theme->name] = dirname($theme->filename);
}
// Check for files named MODULE.config_translation.yml and
......
......@@ -8,7 +8,6 @@
use Drupal\Component\Utility\Xss;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Extension\Extension;
use Drupal\Core\Template\Attribute;
use Drupal\entity\Entity\EntityViewDisplay;
use Drupal\field\Field;
......@@ -158,11 +157,11 @@ function field_cron() {
* Goes through a list of all modules that provide a field type and makes them
* required if there are any active fields of that type.
*/
function field_system_info_alter(&$info, Extension $file, $type) {
function field_system_info_alter(&$info, $file, $type) {
// It is not safe to call entity_load_multiple_by_properties() during
// maintenance mode.
if ($type == 'module' && !defined('MAINTENANCE_MODE')) {
$fields = entity_load_multiple_by_properties('field_config', array('module' => $file->getName(), 'include_deleted' => TRUE));
$fields = entity_load_multiple_by_properties('field_config', array('module' => $file->name, 'include_deleted' => TRUE));
if ($fields) {
$info['required'] = TRUE;
......
......@@ -4,8 +4,6 @@
* @file
* Simulate a custom module with a local po file.
*/
use Drupal\Core\Extension\Extension;
use Drupal\Core\StreamWrapper\PublicStream;
/**
......@@ -14,13 +12,13 @@
* Make the test scripts to be believe this is not a hidden test module, but
* a regular custom module.
*/
function locale_test_system_info_alter(&$info, Extension $file, $type) {
function locale_test_system_info_alter(&$info, $file, $type) {
// Only modify the system info if required.
// By default the locale_test modules are hidden and have a project specified.
// To test the module detection process by locale_project_list() the
// test modules should mimic a custom module. I.e. be non-hidden.
if (\Drupal::state()->get('locale.test_system_info_alter')) {
if ($file->getName() == 'locale_test' || $file->getName() == 'locale_test_translate') {
if ($file->name == 'locale_test' || $file->name == 'locale_test_translate') {
// Don't hide the module.
$info['hidden'] = FALSE;
}
......
......@@ -5,8 +5,6 @@
* Simulates a custom module with a local po file.
*/
use Drupal\Core\Extension\Extension;
/**
* Implements hook_system_info_alter().
*
......@@ -14,8 +12,8 @@
* (not hidden) module. This hook implementation changes the .info.yml data by
* setting the hidden status to FALSE.
*/
function locale_test_translate_system_info_alter(&$info, Extension $file, $type) {
if ($file->getName() == 'locale_test_translate') {
function locale_test_translate_system_info_alter(&$info, $file, $type) {
if ($file->name == 'locale_test_translate') {
// Don't hide the module.
$info['hidden'] = FALSE;
}
......
......@@ -200,17 +200,17 @@ public function themesPage() {
if (!empty($theme->info['hidden'])) {
continue;
}
$theme->is_default = ($theme->getName() == $theme_default);
$theme->is_default = ($theme->name == $theme_default);
// Identify theme screenshot.
$theme->screenshot = NULL;
// Create a list which includes the current theme and all its base themes.
if (isset($themes[$theme->getName()]->base_themes)) {
$theme_keys = array_keys($themes[$theme->getName()]->base_themes);
$theme_keys[] = $theme->getName();
if (isset($themes[$theme->name]->base_themes)) {
$theme_keys = array_keys($themes[$theme->name]->base_themes);
$theme_keys[] = $theme->name;
}
else {
$theme_keys = array($theme->getName());
$theme_keys = array($theme->name);
}
// Look for a screenshot in the current theme or in its closest ancestor.
foreach (array_reverse($theme_keys) as $theme_key) {
......@@ -239,18 +239,18 @@ public function themesPage() {
$theme->operations = array();
if (!empty($theme->status) || !$theme->incompatible_core && !$theme->incompatible_php && !$theme->incompatible_base && !$theme->incompatible_engine) {
// Create the operations links.
$query['theme'] = $theme->getName();
if ($this->themeAccess->checkAccess($theme->getName())) {
$query['theme'] = $theme->name;
if ($this->themeAccess->checkAccess($theme->name)) {
$theme->operations[] = array(
'title' => $this->t('Settings'),
'route_name' => 'system.theme_settings_theme',
'route_parameters' => array('theme' => $theme->getName()),
'route_parameters' => array('theme' => $theme->name),
'attributes' => array('title' => $this->t('Settings for !theme theme', array('!theme' => $theme->info['name']))),
);
}
if (!empty($theme->status)) {
if (!$theme->is_default) {
if ($theme->getName() != $admin_theme) {
if ($theme->name != $admin_theme) {
$theme->operations[] = array(
'title' => $this->t('Disable'),
'route_name' => 'system.theme_disable',
......@@ -265,7 +265,7 @@ public function themesPage() {
'attributes' => array('title' => $this->t('Set !theme as default theme', array('!theme' => $theme->info['name']))),
);
}
$admin_theme_options[$theme->getName()] = $theme->info['name'];
$admin_theme_options[$theme->name] = $theme->info['name'];
}
else {
$theme->operations[] = array(
......@@ -290,7 +290,7 @@ public function themesPage() {
$theme->classes[] = 'theme-default';
$theme->notes[] = $this->t('default theme');
}
if ($theme->getName() == $admin_theme || ($theme->is_default && $admin_theme == '0')) {
if ($theme->name == $admin_theme || ($theme->is_default && $admin_theme == '0')) {
$theme->classes[] = 'theme-admin';
$theme->notes[] = $this->t('admin theme');
}
......
......@@ -11,7 +11,6 @@
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\Query\QueryFactory;
use Drupal\Core\Entity\Query\QueryFactoryInterface;
use Drupal\Core\Extension\Extension;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Form\FormBase;
use Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface;
......@@ -177,14 +176,14 @@ public function buildForm(array $form, array &$form_state) {
*
* @param array $modules
* The list existing modules.
* @param \Drupal\Core\Extension\Extension $module
* @param object $module
* The module for which to build the form row.
* @param $distribution
*
* @return array
* The form row for the given module.
*/
protected function buildRow(array $modules, Extension $module, $distribution) {
protected function buildRow(array $modules, $module, $distribution) {
// Set the basic properties.
$row['#required'] = array();
$row['#requires'] = array();
......@@ -200,12 +199,12 @@ protected function buildRow(array $modules, Extension $module, $distribution) {
// Generate link for module's help page, if there is one.
$row['links']['help'] = array();
if ($help && $module->status && in_array($module->getName(), $this->moduleHandler->getImplementations('help'))) {
if ($this->moduleHandler->invoke($module->getName(), 'help', array('admin/help#' . $module->getName(), $help))) {
if ($help && $module->status && in_array($module->name, $this->moduleHandler->getImplementations('help'))) {
if ($this->moduleHandler->invoke($module->name, 'help', array("admin/help#$module->name", $help))) {
$row['links']['help'] = array(
'#type' => 'link',
'#title' => $this->t('Help'),
'#href' => 'admin/help/' . $module->getName(),
'#href' => "admin/help/$module->name",
'#options' => array('attributes' => array('class' => array('module-link', 'module-link-help'), 'title' => $this->t('Help'))),
);
}
......@@ -213,12 +212,12 @@ protected function buildRow(array $modules, Extension $module, $distribution) {
// Generate link for module's permission, if the user has access to it.
$row['links']['permissions'] = array();
if ($module->status && user_access('administer permissions') && in_array($module->getName(), $this->moduleHandler->getImplementations('permission'))) {
if ($module->status && user_access('administer permissions') && in_array($module->name, $this->moduleHandler->getImplementations('permission'))) {
$row['links']['permissions'] = array(
'#type' => 'link',
'#title' => $this->t('Permissions'),
'#href' => 'admin/people/permissions',
'#options' => array('fragment' => 'module-' . $module->getName(), 'attributes' => array('class' => array('module-link', 'module-link-permissions'), 'title' => $this->t('Configure permissions'))),
'#options' => array('fragment' => 'module-' . $module->name, 'attributes' => array('class' => array('module-link', 'module-link-permissions'), 'title' => $this->t('Configure permissions'))),
);
}
......
......@@ -71,7 +71,7 @@ public function buildForm(array $form, array &$form_state) {
// Get a list of disabled, installed modules.
$modules = system_rebuild_module_data();
$uninstallable = array_filter($modules, function ($module) use ($modules) {
return empty($modules[$module->getName()]->info['required']) && drupal_get_installed_schema_version($module->getName()) > SCHEMA_UNINSTALLED;
return empty($modules[$module->name]->info['required']) && drupal_get_installed_schema_version($module->name) > SCHEMA_UNINSTALLED;
});
$form['modules'] = array();
......@@ -89,12 +89,12 @@ public function buildForm(array $form, array &$form_state) {
$form['uninstall'] = array('#tree' => TRUE);
foreach ($uninstallable as $module) {
$name = $module->info['name'] ?: $module->getName();
$form['modules'][$module->getName()]['#module_name'] = $name;
$form['modules'][$module->getName()]['name']['#markup'] = $name;
$form['modules'][$module->getName()]['description']['#markup'] = $this->t($module->info['description']);
$name = $module->info['name'] ?: $module->name;
$form['modules'][$module->name]['#module_name'] = $name;
$form['modules'][$module->name]['name']['#markup'] = $name;
$form['modules'][$module->name]['description']['#markup'] = $this->t($module->info['description']);
$form['uninstall'][$module->getName()] = array(
$form['uninstall'][$module->name] = array(
'#type' => 'checkbox',
'#title' => $this->t('Uninstall @module module', array('@module' => $name)),
'#title_display' => 'invisible',
......@@ -106,8 +106,8 @@ public function buildForm(array $form, array &$form_state) {
foreach (array_keys($module->required_by) as $dependent) {
if ($dependent != $profile && drupal_get_installed_schema_version($dependent) != SCHEMA_UNINSTALLED) {
$name = isset($modules[$dependent]->info['name']) ? $modules[$dependent]->info['name'] : $dependent;