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
229
Merge Requests
229
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
c33da192
Commit
c33da192
authored
Sep 09, 2009
by
Dries
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Patch
#567092
by rcross, yched, bjaspan: merge hook_field_formatter_info() and hook_theme().
parent
a3f776f4
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
33 additions
and
51 deletions
+33
-51
modules/field/field.api.php
modules/field/field.api.php
+15
-4
modules/field/field.module
modules/field/field.module
+8
-2
modules/field/modules/list/list.module
modules/field/modules/list/list.module
+0
-14
modules/field/modules/number/number.module
modules/field/modules/number/number.module
+10
-4
modules/field/modules/text/text.module
modules/field/modules/text/text.module
+0
-12
modules/file/file.module
modules/file/file.module
+0
-9
modules/taxonomy/taxonomy.module
modules/taxonomy/taxonomy.module
+0
-6
No files found.
modules/field/field.api.php
View file @
c33da192
...
...
@@ -663,14 +663,25 @@ function hook_field_widget_error($element, $error) {
* of drupal_render() on the render structure built by field_attach_view().
*
* The name of the theme hook invoked when displaying the values is derived
* from formatter type names, following the pattern:
* field_formatter_FORMATTER_NAME
* The module implementing the formatters needs to register those theme hooks
* using hook_theme().
* from formatter type names, using the pattern field_formatter_FORMATTER_NAME.
* field.module takes care of exposing the corresponding theme functions
* through hook_theme(). Specifically, field.module defines the theme
* hook:
*
* @code
* 'field_formatter_FORMATTER_NAME' => array(
* 'arguments' => array('element' => NULL),
* )
* @code
*
* If a formatter requires a different theme hook definition,
* implement hook_theme_registry_alter().
*
* @see hook_field_formatter_info().
* @see hook_field_formatter_info_alter().
* @see theme_field_formatter_FORMATTER_NAME().
* @see hook_theme().
* @see hook_theme_registry_alter().
*
* @return
* An array describing the formatter types implemented by the module.
...
...
modules/field/field.module
View file @
c33da192
...
...
@@ -153,8 +153,7 @@ function field_help($path, $arg) {
*/
function
field_theme
()
{
$path
=
drupal_get_path
(
'module'
,
'field'
)
.
'/theme'
;
return
array
(
$items
=
array
(
'field'
=>
array
(
'template'
=>
'field'
,
'arguments'
=>
array
(
'element'
=>
NULL
),
...
...
@@ -164,6 +163,13 @@ function field_theme() {
'arguments'
=>
array
(
'element'
=>
NULL
),
),
);
$field_formatters
=
field_info_formatter_types
(
NULL
);
foreach
(
$field_formatters
as
$key
=>
$field_formatter
)
{
$items
[
"field_formatter_
$key
"
]
=
array
(
'arguments'
=>
array
(
'element'
=>
NULL
),
);
}
return
$items
;
}
/**
...
...
modules/field/modules/list/list.module
View file @
c33da192
...
...
@@ -6,20 +6,6 @@
* Defines list field types that can be used with the Options module.
*/
/**
* Implement hook_theme().
*/
function
list_theme
()
{
return
array
(
'field_formatter_list_default'
=>
array
(
'arguments'
=>
array
(
'element'
=>
NULL
),
),
'field_formatter_list_key'
=>
array
(
'arguments'
=>
array
(
'element'
=>
NULL
),
),
);
}
/**
* Implement hook_field_info().
*/
...
...
modules/field/modules/number/number.module
View file @
c33da192
...
...
@@ -12,12 +12,18 @@
function
number_theme
()
{
return
array
(
'number'
=>
array
(
'arguments'
=>
array
(
'element'
=>
NULL
)),
'field_formatter_number_integer'
=>
array
(
'arguments'
=>
array
(
'element'
=>
NULL
),
'function'
=>
'theme_field_formatter_number'
),
'field_formatter_number_decimal'
=>
array
(
'arguments'
=>
array
(
'element'
=>
NULL
),
'function'
=>
'theme_field_formatter_number'
),
'field_formatter_number_unformatted'
=>
array
(
'arguments'
=>
array
(
'element'
=>
NULL
)),
);
}
/**
* Implement hook_theme_alter().
*/
function
number_theme_registry_alter
(
&
$theme_registry
)
{
// The number_integer and number_decimal formatters use the same function.
$theme_registry
[
'field_formatter_number_integer'
][
'function'
]
=
'theme_field_formatter_number'
;
$theme_registry
[
'field_formatter_number_decimal'
][
'function'
]
=
'theme_field_formatter_number'
;
}
/**
* Implement hook_field_info().
*/
...
...
@@ -204,7 +210,7 @@ function number_field_is_empty($item, $field) {
*/
function
number_field_formatter_info
()
{
return
array
(
'number_
integer
'
=>
array
(
'number_
default
'
=>
array
(
'label'
=>
t
(
'default'
),
'field types'
=>
array
(
'number_integer'
),
'settings'
=>
array
(
...
...
modules/field/modules/text/text.module
View file @
c33da192
...
...
@@ -17,18 +17,6 @@ function text_theme() {
'text_textfield'
=>
array
(
'arguments'
=>
array
(
'element'
=>
NULL
),
),
'field_formatter_text_default'
=>
array
(
'arguments'
=>
array
(
'element'
=>
NULL
),
),
'field_formatter_text_plain'
=>
array
(
'arguments'
=>
array
(
'element'
=>
NULL
),
),
'field_formatter_text_trimmed'
=>
array
(
'arguments'
=>
array
(
'element'
=>
NULL
),
),
'field_formatter_text_summary_or_trimmed'
=>
array
(
'arguments'
=>
array
(
'element'
=>
NULL
),
),
);
}
...
...
modules/file/file.module
View file @
c33da192
...
...
@@ -85,15 +85,6 @@ function file_theme() {
'file_upload_help'
=>
array
(
'arguments'
=>
array
(
'upload_validators'
=>
NULL
),
),
'field_formatter_file_default'
=>
array
(
'arguments'
=>
array
(
'element'
=>
NULL
),
),
'field_formatter_file_table'
=>
array
(
'arguments'
=>
array
(
'element'
=>
NULL
),
),
'field_formatter_file_url_plain'
=>
array
(
'arguments'
=>
array
(
'element'
=>
NULL
),
),
);
}
...
...
modules/taxonomy/taxonomy.module
View file @
c33da192
...
...
@@ -91,12 +91,6 @@ function taxonomy_theme() {
'taxonomy_overview_terms'
=>
array
(
'arguments'
=>
array
(
'form'
=>
array
()),
),
'field_formatter_taxonomy_term_link'
=>
array
(
'arguments'
=>
array
(
'element'
=>
NULL
),
),
'field_formatter_taxonomy_term_plain'
=>
array
(
'arguments'
=>
array
(
'element'
=>
NULL
),
),
'taxonomy_autocomplete'
=>
array
(
'arguments'
=>
array
(
'element'
=>
NULL
),
),
...
...
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