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
288
Merge Requests
288
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
a5ae85b3
Commit
a5ae85b3
authored
Jun 27, 2013
by
Dries
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2019147
by swentel, andypost: Mark functions in field.info.inc deprecated.
parent
4cdff737
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
4 deletions
+54
-4
core/modules/field/field.crud.inc
core/modules/field/field.crud.inc
+12
-0
core/modules/field/field.info.inc
core/modules/field/field.info.inc
+21
-4
core/modules/field/lib/Drupal/field/FieldInfo.php
core/modules/field/lib/Drupal/field/FieldInfo.php
+21
-0
No files found.
core/modules/field/field.crud.inc
View file @
a5ae85b3
...
...
@@ -41,6 +41,9 @@
*
* @return
* A field definition array, or FALSE.
*
* @deprecated as of Drupal 8.0. Use
* entity_load('field_entity', 'field_name').
*/
function
field_read_field
(
$field_name
,
$include_additional
=
array
())
{
$fields
=
field_read_fields
(
array
(
'field_name'
=>
$field_name
),
$include_additional
);
...
...
@@ -63,6 +66,9 @@ function field_read_field($field_name, $include_additional = array()) {
* An array of fields matching $params. If
* $include_additional['include_deleted'] is TRUE, the array is keyed by
* field ID, otherwise it is keyed by field name.
*
* @deprecated as of Drupal 8.0. Use
* entity_load_multiple_by_properties('field_entity', $conditions).
*/
function
field_read_fields
(
$conditions
=
array
(),
$include_additional
=
array
())
{
// Include inactive fields if specified in the $include_additional parameter.
...
...
@@ -99,6 +105,9 @@ function field_read_fields($conditions = array(), $include_additional = array())
*
* @return
* An instance structure, or FALSE.
*
* @deprecated as of Drupal 8.0. Use
* entity_load('field_instance', 'field_name').
*/
function
field_read_instance
(
$entity_type
,
$field_name
,
$bundle
,
$include_additional
=
array
())
{
$instances
=
field_read_instances
(
array
(
'entity_type'
=>
$entity_type
,
'field_name'
=>
$field_name
,
'bundle'
=>
$bundle
),
$include_additional
);
...
...
@@ -120,6 +129,9 @@ function field_read_instance($entity_type, $field_name, $bundle, $include_additi
*
* @return
* An array of instances matching the arguments.
*
* @deprecated as of Drupal 8.0. Use
* entity_load_multiple_by_properties('field_instance', $conditions).
*/
function
field_read_instances
(
$conditions
=
array
(),
$include_additional
=
array
())
{
// Include instances of inactive fields if specified in the
...
...
core/modules/field/field.info.inc
View file @
a5ae85b3
...
...
@@ -155,6 +155,9 @@ function field_behaviors_widget($op, $instance) {
* ),
* );
* @endcode
*
* @deprecated as of Drupal 8.0. Use
* Field::fieldInfo()->getFieldMap().
*/
function
field_info_field_map
()
{
return
Field
::
fieldInfo
()
->
getFieldMap
();
...
...
@@ -292,6 +295,9 @@ function field_info_fields() {
* found.
*
* @see field_info_field_by_id()
* @deprecated as of Drupal 8.0. Use
* Field::fieldInfo()->getField($field_name).
*/
function
field_info_field
(
$field_name
)
{
return
Field
::
fieldInfo
()
->
getField
(
$field_name
);
...
...
@@ -310,6 +316,9 @@ function field_info_field($field_name) {
* belongs to.
*
* @see field_info_field()
*
* @deprecated as of Drupal 8.0. Use
* Field::fieldInfo()->getFieldById($field_id).
*/
function
field_info_field_by_id
(
$field_id
)
{
return
Field
::
fieldInfo
()
->
getFieldById
(
$field_id
);
...
...
@@ -332,6 +341,9 @@ function field_info_field_by_id($field_id) {
*
* @see field_info_field()
* @see field_info_field_by_id()
*
* @deprecated as of Drupal 8.0. Use
* Field::fieldInfo()->getFields().
*/
function
field_info_field_by_ids
()
{
return
Field
::
fieldInfo
()
->
getFields
();
...
...
@@ -361,6 +373,11 @@ function field_info_field_by_ids() {
* bundle name. If $entity_type is set, return all instances for that entity
* type, keyed by bundle name. If $entity_type and $bundle_name are set,
* return all instances for that bundle.
*
* @deprecated as of Drupal 8.0. Use
* Field::fieldInfo()->getInstances(),
* Field::fieldInfo()->getInstances($entity_type) or
* Field::fieldInfo()->getBundleInstances($entity_type, $bundle_name).
*/
function
field_info_instances
(
$entity_type
=
NULL
,
$bundle_name
=
NULL
)
{
$cache
=
Field
::
fieldInfo
();
...
...
@@ -393,12 +410,12 @@ function field_info_instances($entity_type = NULL, $bundle_name = NULL) {
* @return
* An associative array of instance data for the specific field and bundle;
* NULL if the instance does not exist.
*
* @deprecated as of Drupal 8.0. Use
* Field::fieldInfo()->getBundleInstance($entity_type, $bundle, $field_name).
*/
function
field_info_instance
(
$entity_type
,
$field_name
,
$bundle_name
)
{
$info
=
Field
::
fieldInfo
()
->
getBundleInstances
(
$entity_type
,
$bundle_name
);
if
(
isset
(
$info
[
$field_name
]))
{
return
$info
[
$field_name
];
}
return
Field
::
fieldInfo
()
->
getInstance
(
$entity_type
,
$bundle_name
,
$field_name
);
}
/**
...
...
core/modules/field/lib/Drupal/field/FieldInfo.php
View file @
a5ae85b3
...
...
@@ -480,6 +480,27 @@ public function getBundleInstances($entity_type, $bundle) {
return
$instances
;
}
/**
* Returns an array of instance data for a specific field and bundle.
*
* @param string $entity_type
* The entity type for the instance.
* @param string $bundle
* The bundle name for the instance.
* @param string $field_name
* The field name for the instance.
*
* @return array
* An associative array of instance data for the specific field and bundle;
* NULL if the instance does not exist.
*/
function
getInstance
(
$entity_type
,
$bundle
,
$field_name
)
{
$info
=
$this
->
getBundleInstances
(
$entity_type
,
$bundle
);
if
(
isset
(
$info
[
$field_name
]))
{
return
$info
[
$field_name
];
}
}
/**
* Retrieves the "extra fields" for a bundle.
*
...
...
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