Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
2dc655fe
Commit
2dc655fe
authored
Feb 03, 2014
by
catch
Browse files
Issue
#2025779
by Berdir, ianthomas_uk: Remove ModuleInfo as it is no longer necessary.
parent
aba98c73
Changes
4
Hide whitespace changes
Inline
Side-by-side
core/includes/bootstrap.inc
View file @
2dc655fe
...
...
@@ -2446,12 +2446,12 @@ function drupal_classloader_register($name, $path) {
*
* Example:
* @code
* function
system_get_module_info($property
) {
* static $
info
;
* if (
!
isset($
info
)) {
* $
info = new ModuleInfo('system_info', 'cache')
;
* function
drupal_session_started($set = NULL
) {
* static $
session_started = FALSE
;
* if (isset($
set
)) {
* $
session_started = $set
;
* }
* return $
info[$property]
;
* return $
session_started && session_id()
;
* }
* @endcode
*
...
...
core/lib/Drupal/Core/Utility/ModuleInfo.php
deleted
100644 → 0
View file @
aba98c73
<?php
/**
* @file
* Definition of Drupal\Core\Utility\ModuleInfo.
*/
namespace
Drupal\Core\Utility
;
use
Drupal\Core\Utility\CacheArray
;
/**
* Extends CacheArray to lazy load .info.yml properties for modules.
*
* Use system_get_module_info() rather than instantiating this class directly.
*/
class
ModuleInfo
extends
CacheArray
{
/**
* The full module info array as returned by system_get_info().
*/
protected
$info
;
/**
* Implements CacheArray::resolveCacheMiss().
*/
function
resolveCacheMiss
(
$offset
)
{
$data
=
array
();
if
(
!
isset
(
$this
->
info
))
{
$this
->
info
=
system_get_info
(
'module'
);
}
foreach
(
$this
->
info
as
$module
=>
$info
)
{
if
(
isset
(
$info
[
$offset
]))
{
$data
[
$module
]
=
$info
[
$offset
];
}
}
$this
->
storage
[
$offset
]
=
$data
;
$this
->
persist
(
$offset
);
return
$data
;
}
}
core/modules/system/system.module
View file @
2dc655fe
...
...
@@ -2551,27 +2551,6 @@ function system_get_info($type, $name = NULL) {
return
$info
;
}
/**
* Return .info.yml data for modules.
*
* @param string $property
* The .info.yml property to retrieve.
*
* @return array
* An array keyed by module name, with the .info.yml file property as values.
* Only modules with the property specified in their .info.yml file will be
* returned.
*
* @see \Drupal\Core\Utility\ModuleInfo
*/
function
system_get_module_info
(
$property
)
{
static
$info
;
if
(
!
isset
(
$info
))
{
$info
=
new
ModuleInfo
(
'system_info'
,
'cache'
);
}
return
$info
[
$property
];
}
/**
* Helper function to scan and collect module .info.yml data.
*
...
...
core/modules/user/lib/Drupal/user/Plugin/views/field/UserData.php
View file @
2dc655fe
...
...
@@ -66,12 +66,18 @@ protected function defineOptions() {
public
function
buildOptionsForm
(
&
$form
,
&
$form_state
)
{
parent
::
buildOptionsForm
(
$form
,
$form_state
);
$modules
=
system_get_info
(
'module'
);
$names
=
array
();
foreach
(
$modules
as
$name
=>
$module
)
{
$names
[
$name
]
=
$module
[
'name'
];
}
$form
[
'data_module'
]
=
array
(
'#title'
=>
t
(
'Module name'
),
'#type'
=>
'select'
,
'#description'
=>
t
(
'The module which sets this user data.'
),
'#default_value'
=>
$this
->
options
[
'data_module'
],
'#options'
=>
system_get_module_info
(
'
name
'
)
,
'#options'
=>
$
name
s
,
);
$form
[
'data_name'
]
=
array
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment