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
306
Merge Requests
306
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
da60ebc3
Commit
da60ebc3
authored
Jun 26, 2013
by
Dries
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2028175
by effulgentsia: Finish the removal of non-formatter's prepareView().
parent
74c0f3f1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
1 addition
and
63 deletions
+1
-63
core/lib/Drupal/Core/Entity/Field/FieldItemBase.php
core/lib/Drupal/Core/Entity/Field/FieldItemBase.php
+0
-5
core/modules/field/field.module
core/modules/field/field.module
+1
-11
core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterInterface.php
...Drupal/field/Plugin/Type/Formatter/FormatterInterface.php
+0
-3
core/modules/field/lib/Drupal/field/Plugin/field/field_type/LegacyConfigFieldItem.php
...l/field/Plugin/field/field_type/LegacyConfigFieldItem.php
+0
-44
No files found.
core/lib/Drupal/Core/Entity/Field/FieldItemBase.php
View file @
da60ebc3
...
...
@@ -177,9 +177,4 @@ public function delete() { }
*/
public
function
deleteRevision
()
{
}
/**
* {@inheritdoc}
*/
public
static
function
prepareView
(
array
$entities_items
)
{
}
}
core/modules/field/field.module
View file @
da60ebc3
...
...
@@ -776,21 +776,11 @@ function field_view_field(EntityInterface $entity, $field_name, $display_options
$items
=
\
Drupal
::
typedData
()
->
create
(
$definitions
[
$field_name
],
$itemsBC
,
$field_name
,
$entity
);
}
// Invoke
prepare_view steps if needed
.
// Invoke
the formatter's prepareView() and view() methods
.
$id
=
$entity
->
id
();
// First let the field type do its preparation. prepareView() is a static
// method.
$type_definition
=
\
Drupal
::
typedData
()
->
getDefinition
(
$definition
[
'type'
]);
$class
=
$type_definition
[
'class'
];
$class
::
prepareView
(
array
(
$id
=>
$items
),
$definition
);
// Then let the formatter do its own specific massaging.
$itemsBC_multi
=
array
(
$id
=>
$items
->
getValue
());
$formatter
->
prepareView
(
array
(
$id
=>
$entity
),
$display_langcode
,
$itemsBC_multi
);
$itemsBC
=
$itemsBC_multi
[
$id
];
// Build the renderable array.
$result
=
$formatter
->
view
(
$entity
,
$display_langcode
,
$itemsBC
);
// Invoke hook_field_attach_view_alter() to let other modules alter the
...
...
core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterInterface.php
View file @
da60ebc3
...
...
@@ -53,9 +53,6 @@ public function settingsSummary();
* field that displays properties of the referenced entities such as name or
* type.
*
* This method is called after the field type's implementation of
* hook_field_prepare_view().
*
* This method operates on multiple entities. The $entities and $items
* parameters are arrays keyed by entity ID. For performance reasons,
* information for all involved entities should be loaded in a single query
...
...
core/modules/field/lib/Drupal/field/Plugin/field/field_type/LegacyConfigFieldItem.php
View file @
da60ebc3
...
...
@@ -106,50 +106,6 @@ public function prepareCache() {
}
}
/**
* {@inherotdoc}
*/
public
static
function
prepareView
(
array
$entities_items
)
{
if
(
$entities_items
)
{
// Determine the legacy callback.
$field_type_definition
=
current
(
$entities_items
)
->
getPluginDefinition
();
$module
=
$field_type_definition
[
'module'
];
$callback
=
"
{
$module
}
_field_prepare_view"
;
if
(
function_exists
(
$callback
))
{
$entities
=
array
();
$instances
=
array
();
$itemsBC
=
array
();
foreach
(
$entities_items
as
$id
=>
$items
)
{
$entities
[
$id
]
=
$items
->
getParent
();
$instances
[
$id
]
=
$items
->
offsetGet
(
0
)
->
getInstance
();
// We need to remove the empty "prototype" item here.
// @todo Revisit after http://drupal.org/node/1988492.
$items
->
filterEmptyValues
();
$itemsBC
[
$id
]
=
$items
->
getValue
(
TRUE
);
}
// Determine the entity type, langcode and field.
$entity_type
=
current
(
$entities
)
->
entityType
();
$langcode
=
current
(
$entities
)
->
language
()
->
langcode
;
$field
=
current
(
$instances
)
->
getField
();
$args
=
array
(
$entity_type
,
$entities
,
$field
,
$instances
,
$langcode
,
&
$itemsBC
,
);
call_user_func_array
(
$callback
,
$args
);
foreach
(
$entities_items
as
$id
=>
$items
)
{
$items
->
setValue
(
$itemsBC
[
$id
]);
}
}
}
}
/**
* Returns the legacy callback for a given field type "hook".
*
...
...
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