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
304
Merge Requests
304
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
198846a8
Commit
198846a8
authored
Nov 17, 2012
by
catch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#1804394
by deviance, Albert Volkman: Convert file.module variables to CMI.
parent
d1400e30
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
7 deletions
+29
-7
core/modules/file/config/file.settings.yml
core/modules/file/config/file.settings.yml
+6
-0
core/modules/file/file.field.inc
core/modules/file/file.field.inc
+3
-2
core/modules/file/file.install
core/modules/file/file.install
+13
-0
core/modules/file/file.module
core/modules/file/file.module
+7
-5
No files found.
core/modules/file/config/file.settings.yml
0 → 100644
View file @
198846a8
description
:
type
:
'
textfield'
length
:
128
icon
:
directory
:
'
core/modules/file/icons'
core/modules/file/file.field.inc
View file @
198846a8
...
...
@@ -427,11 +427,12 @@ function file_field_widget_process($element, &$form_state, $form) {
// Add the description field if enabled.
if
(
!
empty
(
$instance
[
'settings'
][
'description_field'
])
&&
$item
[
'fid'
])
{
$config
=
config
(
'file.settings'
);
$element
[
'description'
]
=
array
(
'#type'
=>
variable_get
(
'file_description_type'
,
'textfield
'
),
'#type'
=>
$config
->
get
(
'description.type
'
),
'#title'
=>
t
(
'Description'
),
'#value'
=>
isset
(
$item
[
'description'
])
?
$item
[
'description'
]
:
''
,
'#maxlength'
=>
variable_get
(
'file_description_length'
,
128
),
'#maxlength'
=>
$config
->
get
(
'description.length'
),
'#description'
=>
t
(
'The description may be used as the label of the link to the file.'
),
);
}
...
...
core/modules/file/file.install
View file @
198846a8
...
...
@@ -232,3 +232,16 @@ function file_requirements($phase) {
return
$requirements
;
}
/**
* Converts default_file_main variable to config.
*
* @ingroup config_upgrade
*/
function
file_update_8000
()
{
update_variables_to_config
(
'file.settings'
,
array
(
'file_description_type'
=>
'description.type'
,
'file_description_length'
=>
'description.length'
,
'file_icon_directory'
=>
'icon.directory'
,
));
}
core/modules/file/file.module
View file @
198846a8
...
...
@@ -1231,7 +1231,8 @@ function file_managed_file_pre_render($element) {
* An associative array containing:
* - file: A file object to which the link will be created.
* - icon_directory: (optional) A path to a directory of icons to be used for
* files. Defaults to the value of the "file_icon_directory" variable.
* files. Defaults to the value of the "icon.directory"
* variable.
*
* @ingroup themeable
*/
...
...
@@ -1270,7 +1271,8 @@ function theme_file_link($variables) {
* An associative array containing:
* - file: A file entity for which to make an icon.
* - icon_directory: (optional) A path to a directory of icons to be used for
* files. Defaults to the value of the "file_icon_directory" variable.
* files. Defaults to the value of the "icon.directory"
* variable.
*
* @ingroup themeable
*/
...
...
@@ -1290,7 +1292,7 @@ function theme_file_icon($variables) {
* A file entity.
* @param $icon_directory
* (optional) A path to a directory of icons to be used for files. Defaults to
* the value of the "
file_icon_
directory" variable.
* the value of the "
icon.
directory" variable.
*
* @return
* A URL string to the icon, or FALSE if an appropriate icon cannot be found.
...
...
@@ -1309,7 +1311,7 @@ function file_icon_url(File $file, $icon_directory = NULL) {
* A file entity.
* @param $icon_directory
* (optional) A path to a directory of icons to be used for files. Defaults to
* the value of the "
file_icon_
directory" variable.
* the value of the "
icon.
directory" variable.
*
* @return
* A string to the icon as a local path, or FALSE if an appropriate icon could
...
...
@@ -1318,7 +1320,7 @@ function file_icon_url(File $file, $icon_directory = NULL) {
function
file_icon_path
(
File
$file
,
$icon_directory
=
NULL
)
{
// Use the default set of icons if none specified.
if
(
!
isset
(
$icon_directory
))
{
$icon_directory
=
variable_get
(
'file_icon_directory'
,
drupal_get_path
(
'module'
,
'file'
)
.
'/icons
'
);
$icon_directory
=
config
(
'file.settings'
)
->
get
(
'icon.directory
'
);
}
// If there's an icon matching the exact mimetype, go for it.
...
...
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