Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
297
Merge Requests
297
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
2c51074d
Commit
2c51074d
authored
Mar 07, 2014
by
alexpott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2210197
by sun, longwave: Remove public access to Extension::$type, ::$name, ::$filename.
parent
2187fd1e
Changes
34
Hide whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
172 additions
and
193 deletions
+172
-193
core/includes/install.core.inc
core/includes/install.core.inc
+9
-9
core/includes/install.inc
core/includes/install.inc
+2
-4
core/includes/module.inc
core/includes/module.inc
+1
-1
core/includes/theme.inc
core/includes/theme.inc
+6
-6
core/lib/Drupal/Core/DrupalKernel.php
core/lib/Drupal/Core/DrupalKernel.php
+2
-4
core/lib/Drupal/Core/Extension/Extension.php
core/lib/Drupal/Core/Extension/Extension.php
+2
-27
core/lib/Drupal/Core/Extension/ExtensionDiscovery.php
core/lib/Drupal/Core/Extension/ExtensionDiscovery.php
+5
-9
core/lib/Drupal/Core/Extension/ModuleHandler.php
core/lib/Drupal/Core/Extension/ModuleHandler.php
+3
-3
core/lib/Drupal/Core/Extension/ThemeHandler.php
core/lib/Drupal/Core/Extension/ThemeHandler.php
+2
-3
core/lib/Drupal/Core/Template/TwigEnvironment.php
core/lib/Drupal/Core/Template/TwigEnvironment.php
+8
-5
core/lib/Drupal/Core/Theme/Registry.php
core/lib/Drupal/Core/Theme/Registry.php
+9
-9
core/lib/Drupal/Core/Utility/ProjectInfo.php
core/lib/Drupal/Core/Utility/ProjectInfo.php
+8
-7
core/modules/config_translation/lib/Drupal/config_translation/ConfigMapperManager.php
...ion/lib/Drupal/config_translation/ConfigMapperManager.php
+1
-1
core/modules/field/field.module
core/modules/field/field.module
+3
-2
core/modules/locale/tests/modules/locale_test/locale_test.module
...dules/locale/tests/modules/locale_test/locale_test.module
+4
-2
core/modules/locale/tests/modules/locale_test_translate/locale_test_translate.module
...odules/locale_test_translate/locale_test_translate.module
+4
-2
core/modules/system/lib/Drupal/system/Controller/SystemController.php
.../system/lib/Drupal/system/Controller/SystemController.php
+11
-11
core/modules/system/lib/Drupal/system/Form/ModulesListForm.php
...modules/system/lib/Drupal/system/Form/ModulesListForm.php
+8
-7
core/modules/system/lib/Drupal/system/Form/ModulesUninstallForm.php
...es/system/lib/Drupal/system/Form/ModulesUninstallForm.php
+8
-8
core/modules/system/lib/Drupal/system/Form/ThemeSettingsForm.php
...dules/system/lib/Drupal/system/Form/ThemeSettingsForm.php
+1
-1
core/modules/system/lib/Drupal/system/Tests/Bootstrap/GetFilenameUnitTest.php
...lib/Drupal/system/Tests/Bootstrap/GetFilenameUnitTest.php
+4
-4
core/modules/system/lib/Drupal/system/Tests/Common/SystemListingTest.php
...stem/lib/Drupal/system/Tests/Common/SystemListingTest.php
+4
-4
core/modules/system/system.admin.inc
core/modules/system/system.admin.inc
+5
-4
core/modules/system/system.api.php
core/modules/system/system.api.php
+8
-9
core/modules/system/system.module
core/modules/system/system.module
+3
-6
core/modules/system/tests/modules/module_test/module_test.module
...dules/system/tests/modules/module_test/module_test.module
+12
-10
core/modules/system/tests/modules/system_test/system_test.module
...dules/system/tests/modules/system_test/system_test.module
+7
-6
core/modules/system/tests/modules/theme_page_test/theme_page_test.module
...stem/tests/modules/theme_page_test/theme_page_test.module
+3
-1
core/modules/update/tests/modules/update_test/update_test.module
...dules/update/tests/modules/update_test/update_test.module
+3
-2
core/modules/views/lib/Drupal/views/ViewExecutable.php
core/modules/views/lib/Drupal/views/ViewExecutable.php
+2
-2
core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php
core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php
+11
-11
core/tests/Drupal/Tests/Core/Theme/RegistryTest.php
core/tests/Drupal/Tests/Core/Theme/RegistryTest.php
+3
-5
core/themes/engines/phptemplate/phptemplate.engine
core/themes/engines/phptemplate/phptemplate.engine
+5
-4
core/themes/engines/twig/twig.engine
core/themes/engines/twig/twig.engine
+5
-4
No files found.
core/includes/install.core.inc
View file @
2c51074d
...
...
@@ -835,7 +835,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
=
dirname
(
$install_state
[
'profiles'
][
$profile
]
->
uri
)
.
'/'
.
$profile
.
'.install'
;
$profile_install_file
=
$install_state
[
'profiles'
][
$profile
]
->
getPath
(
)
.
'/'
.
$profile
.
'.install'
;
if
(
file_exists
(
$profile_install_file
))
{
include_once
DRUPAL_ROOT
.
'/'
.
$profile_install_file
;
}
...
...
@@ -1351,19 +1351,19 @@ function _install_select_profile($profiles) {
$request_params
=
\
Drupal
::
request
()
->
request
;
if
(
count
(
$profiles
)
==
1
)
{
$profile
=
array_pop
(
$profiles
);
return
$profile
->
name
;
return
$profile
->
getName
()
;
}
elseif
(
$request_params
->
has
(
'profile'
)
&&
(
$profile
=
$request_params
->
get
(
'profile'
))
&&
isset
(
$profiles
[
$profile
]))
{
return
$profiles
[
$profile
]
->
name
;
return
$profiles
[
$profile
]
->
getName
()
;
}
// 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
->
name
);
$profile_info
=
install_profile_info
(
$profile
->
getName
()
);
if
(
!
empty
(
$profile_info
[
'exclusive'
]))
{
if
(
empty
(
$exclusive_profile
))
{
$exclusive_profile
=
$profile
->
name
;
$exclusive_profile
=
$profile
->
getName
()
;
}
else
{
// We found a second "exclusive" profile. There's no way to choose
...
...
@@ -1388,7 +1388,7 @@ function install_select_profile_form($form, &$form_state, $install_state) {
$names
=
array
();
foreach
(
$install_state
[
'profiles'
]
as
$profile
)
{
$details
=
install_profile_info
(
$profile
->
name
);
$details
=
install_profile_info
(
$profile
->
getName
()
);
// Skip this extension if its type is not profile.
if
(
!
isset
(
$details
[
'type'
])
||
$details
[
'type'
]
!=
'profile'
)
{
continue
;
...
...
@@ -1398,12 +1398,12 @@ function install_select_profile_form($form, &$form_state, $install_state) {
if
(
$details
[
'hidden'
]
===
TRUE
)
{
continue
;
}
$profiles
[
$profile
->
name
]
=
$details
;
$profiles
[
$profile
->
getName
()
]
=
$details
;
// Determine the name of the profile; default to file name if defined name
// is unspecified.
$name
=
isset
(
$details
[
'name'
])
?
$details
[
'name'
]
:
$profile
->
name
;
$names
[
$profile
->
name
]
=
$name
;
$name
=
isset
(
$details
[
'name'
])
?
$details
[
'name'
]
:
$profile
->
getName
()
;
$names
[
$profile
->
getName
()
]
=
$name
;
}
// Display radio buttons alphabetically by human-readable name, but always
...
...
core/includes/install.inc
View file @
2c51074d
...
...
@@ -573,9 +573,7 @@ function drupal_verify_profile($install_state) {
include_once
__DIR__
.
'/common.inc'
;
$profile
=
$install_state
[
'parameters'
][
'profile'
];
$profile_file
=
$install_state
[
'profiles'
][
$profile
]
->
uri
;
if
(
!
isset
(
$profile
)
||
!
file_exists
(
$profile_file
))
{
if
(
!
isset
(
$profile
)
||
!
isset
(
$install_state
[
'profiles'
][
$profile
]))
{
throw
new
Exception
(
install_no_profile_error
());
}
$info
=
$install_state
[
'profile_info'
];
...
...
@@ -584,7 +582,7 @@ function drupal_verify_profile($install_state) {
$listing
=
new
ExtensionDiscovery
();
$present_modules
=
array
();
foreach
(
$listing
->
scan
(
'module'
)
as
$present_module
)
{
$present_modules
[]
=
$present_module
->
name
;
$present_modules
[]
=
$present_module
->
getName
()
;
}
// The installation profile is also a module, which needs to be installed
...
...
core/includes/module.inc
View file @
2c51074d
...
...
@@ -63,7 +63,7 @@ function system_list($type) {
$lists
[
'filepaths'
][]
=
array
(
'type'
=>
'theme'
,
'name'
=>
$name
,
'filepath'
=>
$theme
->
filename
,
'filepath'
=>
$theme
->
getPathname
()
,
);
}
}
...
...
core/includes/theme.inc
View file @
2c51074d
...
...
@@ -79,7 +79,7 @@
*/
function
drupal_theme_access
(
$theme
)
{
if
(
$theme
instanceof
Extension
)
{
$theme
=
$theme
->
name
;
$theme
=
$theme
->
getName
()
;
}
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
=
dirname
(
$theme
->
filename
);
$theme_path
=
$theme
->
getPath
(
);
// 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
=
dirname
(
$base
->
filename
);
$base_theme_path
=
$base
->
getPath
(
);
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
->
name
]
=
dirname
(
$theme_info
->
filename
);
$theme_paths
[
$theme_info
->
base_theme
][
$theme_info
->
getName
()]
=
$theme_info
->
getPath
(
);
}
}
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
(
dirname
(
$theme_object
->
filename
)
.
'/logo.png'
));
$cache
[
$theme
]
->
set
(
'logo.url'
,
file_create_url
(
$theme_object
->
getPath
(
)
.
'/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
=
dirname
(
$theme_object
->
filename
)
.
'/favicon.ico'
))
{
if
(
file_exists
(
$favicon
=
$theme_object
->
getPath
(
)
.
'/favicon.ico'
))
{
$cache
[
$theme
]
->
set
(
'favicon.url'
,
file_create_url
(
$favicon
));
}
else
{
...
...
core/lib/Drupal/Core/DrupalKernel.php
View file @
2c51074d
...
...
@@ -290,10 +290,8 @@ public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQ
* @param $module
* The name of the module.
*
* @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.
* @return \Drupal\Core\Extension\Extension|bool
* Returns an Extension object if the module is found, FALSE otherwise.
*/
protected
function
moduleData
(
$module
)
{
if
(
!
$this
->
moduleData
)
{
...
...
core/lib/Drupal/Core/Extension/Extension.php
View file @
2c51074d
...
...
@@ -15,11 +15,9 @@ class Extension implements \Serializable {
/**
* The type of the extension (e.g., 'module').
*
* @todo Replace all uses of $type with getType() method.
*
* @var string
*/
p
ublic
$type
;
p
rotected
$type
;
/**
* The relative pathname of the extension (e.g., 'core/modules/node/node.info.yml').
...
...
@@ -28,15 +26,6 @@ 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').
*
...
...
@@ -50,21 +39,9 @@ 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
*/
p
ublic
$filename
;
p
rotected
$filename
;
/**
* An SplFileInfo instance for the extension's info file.
...
...
@@ -90,7 +67,6 @@ 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
;
}
...
...
@@ -207,7 +183,6 @@ 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'
];
...
...
core/lib/Drupal/Core/Extension/ExtensionDiscovery.php
View file @
2c51074d
...
...
@@ -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
->
name
]))
{
if
(
isset
(
$files
[
$file
->
getName
()
]))
{
// 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
->
name
]
=
$file
;
$files
[
$file
->
getName
()
]
=
$file
;
}
return
$files
;
}
...
...
@@ -366,16 +366,12 @@ protected function scanDirectory($dir, $include_tests) {
$name
=
$fileinfo
->
getBasename
(
'.info.yml'
);
$pathname
=
$dir_prefix
.
$fileinfo
->
getSubPathname
();
// Supply main extension filename being used throughout Drupal.
// For themes, the filename is the info file itself.
if
(
$type
==
'theme'
)
{
$filename
=
$fileinfo
->
getFilename
();
}
// Determine whether the extension has a main extension file.
// For theme engines, the file extension is .engine.
else
if
(
$type
==
'theme_engine'
)
{
if
(
$type
==
'theme_engine'
)
{
$filename
=
$name
.
'.engine'
;
}
//
Otherwise, it is .module/.profile; i.e.,
the extension type.
//
For profiles/modules/themes, it is
the extension type.
else
{
$filename
=
$name
.
'.'
.
$type
;
}
...
...
core/lib/Drupal/Core/Extension/ModuleHandler.php
View file @
2c51074d
...
...
@@ -145,11 +145,11 @@ public function setModuleList(array $module_list = array()) {
*/
public
function
buildModuleDependencies
(
array
$modules
)
{
foreach
(
$modules
as
$module
)
{
$graph
[
$module
->
name
][
'edges'
]
=
array
();
$graph
[
$module
->
getName
()
][
'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
->
name
][
'edges'
][
$dependency_data
[
'name'
]]
=
$dependency_data
;
$graph
[
$module
->
getName
()
][
'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
->
name
;
$theme_keys
[]
=
$base
->
getName
()
;
}
$theme_keys
[]
=
$theme
;
foreach
(
$theme_keys
as
$theme_key
)
{
...
...
core/lib/Drupal/Core/Extension/ThemeHandler.php
View file @
2c51074d
...
...
@@ -220,7 +220,7 @@ public function listInfo() {
if
(
!
isset
(
$theme
->
status
))
{
$theme
->
status
=
0
;
}
$this
->
list
[
$theme
->
name
]
=
$theme
;
$this
->
list
[
$theme
->
getName
()
]
=
$theme
;
}
}
return
$this
->
list
;
...
...
@@ -271,7 +271,6 @@ 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
...
...
@@ -292,7 +291,7 @@ public function rebuildThemeData() {
$engine
=
$theme
->
info
[
'engine'
];
if
(
isset
(
$engines
[
$engine
]))
{
$theme
->
owner
=
$engines
[
$engine
]
->
uri
;
$theme
->
prefix
=
$engines
[
$engine
]
->
name
;
$theme
->
prefix
=
$engines
[
$engine
]
->
getName
()
;
}
// Prefix stylesheets, scripts, and screenshot with theme path.
...
...
core/lib/Drupal/Core/Template/TwigEnvironment.php
View file @
2c51074d
...
...
@@ -39,13 +39,16 @@ public function __construct(\Twig_LoaderInterface $loader = NULL, $options = arr
$this
->
cache_object
=
\
Drupal
::
cache
();
// Set twig path namespace for themes and modules.
$namespaces
=
$module_handler
->
getModuleList
();
foreach
(
$theme_handler
->
listInfo
()
as
$theme
=>
$info
)
{
$namespaces
[
$theme
]
=
$info
->
filename
;
$namespaces
=
array
();
foreach
(
$module_handler
->
getModuleList
()
as
$name
=>
$filename
)
{
$namespaces
[
$name
]
=
dirname
(
$filename
);
}
foreach
(
$theme_handler
->
listInfo
()
as
$name
=>
$extension
)
{
$namespaces
[
$name
]
=
$extension
->
getPath
();
}
foreach
(
$namespaces
as
$name
=>
$
filename
)
{
$templatesDirectory
=
dirname
(
$filename
)
.
'/templates'
;
foreach
(
$namespaces
as
$name
=>
$
path
)
{
$templatesDirectory
=
$path
.
'/templates'
;
if
(
file_exists
(
$templatesDirectory
))
{
$loader
->
addPath
(
$templatesDirectory
,
$name
);
}
...
...
core/lib/Drupal/Core/Theme/Registry.php
View file @
2c51074d
...
...
@@ -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'
]
->
name
)
{
if
(
$GLOBALS
[
'theme'
]
!=
$GLOBALS
[
'theme_info'
]
->
getName
()
)
{
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
->
name
))
{
if
(
$cache
=
$this
->
cache
->
get
(
'theme_registry:'
.
$this
->
theme
->
getName
()
))
{
$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
->
name
,
$this
->
cache
,
$this
->
lock
,
array
(
'theme_registry'
=>
TRUE
),
$this
->
moduleHandler
->
isLoaded
());
$this
->
runtimeRegistry
=
new
ThemeRegistry
(
'theme_registry:runtime:'
.
$this
->
theme
->
getName
()
,
$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
->
name
,
$this
->
registry
,
Cache
::
PERMANENT
,
array
(
'theme_registry'
=>
TRUE
));
$this
->
cache
->
set
(
'theme_registry:'
.
$this
->
theme
->
getName
()
,
$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
=
dirname
(
$base
->
filename
);
$base_path
=
$base
->
getPath
(
);
if
(
$this
->
engine
)
{
$this
->
processExtension
(
$cache
,
$this
->
engine
,
'base_theme_engine'
,
$base
->
name
,
$base_path
);
$this
->
processExtension
(
$cache
,
$this
->
engine
,
'base_theme_engine'
,
$base
->
getName
()
,
$base_path
);
}
$this
->
processExtension
(
$cache
,
$base
->
name
,
'base_theme'
,
$base
->
name
,
$base_path
);
$this
->
processExtension
(
$cache
,
$base
->
getName
(),
'base_theme'
,
$base
->
getName
()
,
$base_path
);
}
// And then the same thing, but for the theme.
if
(
$this
->
engine
)
{
$this
->
processExtension
(
$cache
,
$this
->
engine
,
'theme_engine'
,
$this
->
theme
->
name
,
dirname
(
$this
->
theme
->
filename
));
$this
->
processExtension
(
$cache
,
$this
->
engine
,
'theme_engine'
,
$this
->
theme
->
getName
(),
$this
->
theme
->
getPath
(
));
}
// Finally, hooks provided by the theme itself.
$this
->
processExtension
(
$cache
,
$this
->
theme
->
name
,
'theme'
,
$this
->
theme
->
name
,
dirname
(
$this
->
theme
->
filename
));
$this
->
processExtension
(
$cache
,
$this
->
theme
->
getName
(),
'theme'
,
$this
->
theme
->
getName
(),
$this
->
theme
->
getPath
(
));
// Let modules alter the registry.
$this
->
moduleHandler
->
alter
(
'theme_registry'
,
$cache
);
...
...
core/lib/Drupal/Core/Utility/ProjectInfo.php
View file @
2c51074d
...
...
@@ -9,6 +9,8 @@
namespace
Drupal\Core\Utility
;
use
Drupal\Core\Extension\Extension
;
/**
* Performs operations on drupal.org project data.
*/
...
...
@@ -94,8 +96,7 @@ 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'
]))
{
$info_filename
=
dirname
(
$file
->
uri
)
.
'/'
.
$file
->
name
.
'.info.yml'
;
$file
->
info
[
'_info_file_ctime'
]
=
filectime
(
$info_filename
);
$file
->
info
[
'_info_file_ctime'
]
=
$file
->
getCTime
();
}
if
(
!
isset
(
$file
->
info
[
'datestamp'
]))
{
...
...
@@ -142,7 +143,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
->
name
=>
$file
->
info
[
'name'
]),
'includes'
=>
array
(
$file
->
getName
()
=>
$file
->
info
[
'name'
]),
'project_type'
=>
$project_display_type
,
'project_status'
=>
$status
,
'sub_themes'
=>
$sub_themes
,
...
...
@@ -155,7 +156,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
->
name
]
=
$file
->
info
[
'name'
];
$projects
[
$project_name
][
'includes'
][
$file
->
getName
()
]
=
$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
))
{
...
...
@@ -170,7 +171,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
->
name
]
=
$file
->
info
[
'name'
];
$projects
[
$project_name
][
'disabled'
][
$file
->
getName
()
]
=
$file
->
info
[
'name'
];
}
}
}
...
...
@@ -184,12 +185,12 @@ function processInfoList(array &$projects, array $list, $project_type, $status,
* @return string
* The canonical project short name.
*/
function
getProjectName
(
$file
)
{
function
getProjectName
(
Extension
$file
)
{
$project_name
=
''
;
if
(
isset
(
$file
->
info
[
'project'
]))
{
$project_name
=
$file
->
info
[
'project'
];
}
elseif
(
isset
(
$file
->
filename
)
&&
(
strpos
(
$file
->
filename
,
'core/modules'
)
===
0
)
)
{
elseif
(
strpos
(
$file
->
getPath
(),
'core/modules'
)
===
0
)
{
$project_name
=
'drupal'
;
}
return
$project_name
;
...
...
core/modules/config_translation/lib/Drupal/config_translation/ConfigMapperManager.php
View file @
2c51074d
...
...
@@ -72,7 +72,7 @@ public function __construct(CacheBackendInterface $cache_backend, LanguageManage
$directories
[
$module
]
=
dirname
(
$filename
);
}
foreach
(
$theme_handler
->
listInfo
()
as
$theme
)
{
$directories
[
$theme
->
name
]
=
dirname
(
$theme
->
filename
);
$directories
[
$theme
->
getName
()]
=
$theme
->
getPath
(
);
}
// Check for files named MODULE.config_translation.yml and
...
...
core/modules/field/field.module
View file @
2c51074d
...
...
@@ -8,6 +8,7 @@
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
;
...
...
@@ -157,11 +158,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
,
$file
,
$type
)
{
function
field_system_info_alter
(
&
$info
,
Extension
$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
->
name
,
'include_deleted'
=>
TRUE
));
$fields
=
entity_load_multiple_by_properties
(
'field_config'
,
array
(
'module'
=>
$file
->
getName
()
,
'include_deleted'
=>
TRUE
));
if
(
$fields
)
{
$info
[
'required'
]
=
TRUE
;
...
...
core/modules/locale/tests/modules/locale_test/locale_test.module
View file @
2c51074d
...
...
@@ -4,6 +4,8 @@
* @file
* Simulate a custom module with a local po file.
*/
use
Drupal\Core\Extension\Extension
;
use
Drupal\Core\StreamWrapper\PublicStream
;
/**
...
...
@@ -12,13 +14,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
,
$file
,
$type
)
{
function
locale_test_system_info_alter
(
&
$info
,
Extension
$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
->
name
==
'locale_test'
||
$file
->
name
==
'locale_test_translate'
)
{
if
(
$file
->
getName
()
==
'locale_test'
||
$file
->
getName
()
==
'locale_test_translate'
)
{
// Don't hide the module.
$info
[
'hidden'
]
=
FALSE
;
}
...
...
core/modules/locale/tests/modules/locale_test_translate/locale_test_translate.module
View file @
2c51074d
...
...
@@ -5,6 +5,8 @@
* Simulates a custom module with a local po file.
*/
use
Drupal\Core\Extension\Extension
;
/**
* Implements hook_system_info_alter().
*
...
...
@@ -12,8 +14,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
,
$file
,
$type
)
{
if
(
$file
->
name
==
'locale_test_translate'
)
{
function
locale_test_translate_system_info_alter
(
&
$info
,
Extension
$file
,
$type
)
{
if
(
$file
->
getName
()
==
'locale_test_translate'
)
{
// Don't hide the module.
$info
[
'hidden'
]
=
FALSE
;
}
...
...
core/modules/system/lib/Drupal/system/Controller/SystemController.php
View file @
2c51074d
...
...
@@ -200,17 +200,17 @@ public function themesPage() {
if
(
!
empty
(
$theme
->
info
[
'hidden'
]))
{
continue
;
}
$theme
->
is_default
=
(
$theme
->
name
==
$theme_default
);
$theme
->
is_default
=
(
$theme
->
getName
()
==
$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
->
name
]
->
base_themes
))
{
$theme_keys
=
array_keys
(
$themes
[
$theme
->
name
]
->
base_themes
);
$theme_keys
[]
=
$theme
->
name
;
if
(
isset
(
$themes
[
$theme
->
getName
()
]
->
base_themes
))
{
$theme_keys
=
array_keys
(
$themes
[
$theme
->
getName
()
]
->
base_themes
);
$theme_keys
[]
=
$theme
->
getName
()
;
}
else
{
$theme_keys
=
array
(
$theme
->
name
);
$theme_keys
=
array
(
$theme
->
getName
()
);
}
// 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
->
name
;
if
(
$this
->
themeAccess
->
checkAccess
(
$theme
->
name
))
{
$query
[
'theme'
]
=
$theme
->
getName
()
;
if
(
$this
->
themeAccess
->
checkAccess
(
$theme
->
getName
()
))
{
$theme
->
operations
[]
=
array
(
'title'
=>
$this
->
t
(
'Settings'
),
'route_name'
=>
'system.theme_settings_theme'
,
'route_parameters'
=>
array
(
'theme'
=>
$theme
->
name
),
'route_parameters'
=>
array
(
'theme'
=>
$theme
->
getName
()
),
'attributes'
=>
array
(
'title'
=>
$this
->
t
(
'Settings for !theme theme'
,
array
(
'!theme'
=>
$theme
->
info
[
'name'
]))),
);
}
if
(
!
empty
(
$theme
->
status
))
{
if
(
!
$theme
->
is_default
)
{
if
(
$theme
->
name
!=
$admin_theme
)
{
if
(
$theme
->
getName
()
!=
$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
->
name
]
=
$theme
->
info
[
'name'
];
$admin_theme_options
[
$theme
->
getName
()
]
=
$theme
->
info
[
'name'
];
}