Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
89773d1a
Commit
89773d1a
authored
11 years ago
by
Angie Byron
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2092265
by andypost, Xano, amateescu: Fix type-hinting for FieldInfo methods.
parent
c3924101
No related branches found
No related tags found
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/modules/field/lib/Drupal/field/FieldInfo.php
+30
-31
30 additions, 31 deletions
core/modules/field/lib/Drupal/field/FieldInfo.php
with
30 additions
and
31 deletions
core/modules/field/lib/Drupal/field/FieldInfo.php
+
30
−
31
View file @
89773d1a
...
@@ -71,7 +71,7 @@ class FieldInfo {
...
@@ -71,7 +71,7 @@ class FieldInfo {
/**
/**
* List of $field structures keyed by ID. Includes deleted fields.
* List of $field structures keyed by ID. Includes deleted fields.
*
*
* @var
array
* @var
\Drupal\field\FieldInterface[]
*/
*/
protected
$fieldsById
=
array
();
protected
$fieldsById
=
array
();
...
@@ -166,7 +166,7 @@ public function flush() {
...
@@ -166,7 +166,7 @@ public function flush() {
/**
/**
* Collects a lightweight map of fields across bundles.
* Collects a lightweight map of fields across bundles.
*
*
* @return
* @return
array
* An array keyed by entity type. Each value is an array which keys are
* An array keyed by entity type. Each value is an array which keys are
* field names and value is an array with two entries:
* field names and value is an array with two entries:
* - type: The field type.
* - type: The field type.
...
@@ -218,8 +218,8 @@ public function getFieldMap() {
...
@@ -218,8 +218,8 @@ public function getFieldMap() {
/**
/**
* Returns all active fields, including deleted ones.
* Returns all active fields, including deleted ones.
*
*
* @return
* @return
\Drupal\field\FieldInterface[]
* An array of field
defin
iti
on
s, keyed by field ID.
* An array of field
ent
iti
e
s, keyed by field ID.
*/
*/
public
function
getFields
()
{
public
function
getFields
()
{
// Read from the "static" cache.
// Read from the "static" cache.
...
@@ -256,10 +256,10 @@ public function getFields() {
...
@@ -256,10 +256,10 @@ public function getFields() {
/**
/**
* Retrieves all active, non-deleted instances definitions.
* Retrieves all active, non-deleted instances definitions.
*
*
* @param $entity_type
* @param
string
$entity_type
* (optional) The entity type.
* (optional) The entity type.
*
*
* @return
* @return
array
* If $entity_type is not set, all instances keyed by entity type and bundle
* If $entity_type is not set, all instances keyed by entity type and bundle
* name. If $entity_type is set, all instances for that entity type, keyed
* name. If $entity_type is set, all instances for that entity type, keyed
* by bundle name.
* by bundle name.
...
@@ -309,7 +309,7 @@ public function getInstances($entity_type = NULL) {
...
@@ -309,7 +309,7 @@ public function getInstances($entity_type = NULL) {
* @param string $field_name
* @param string $field_name
* The field name.
* The field name.
*
*
* @return
* @return
\Drupal\field\FieldInterface|null
* The field definition, or NULL if no field was found.
* The field definition, or NULL if no field was found.
*/
*/
public
function
getField
(
$entity_type
,
$field_name
)
{
public
function
getField
(
$entity_type
,
$field_name
)
{
...
@@ -340,15 +340,15 @@ public function getField($entity_type, $field_name) {
...
@@ -340,15 +340,15 @@ public function getField($entity_type, $field_name) {
}
}
/**
/**
* Returns a field
definition
from a field ID.
* Returns a field
entity
from a field ID.
*
*
* This method only retrieves active fields, deleted or not.
* This method only retrieves active fields, deleted or not.
*
*
* @param $field_id
* @param
string
$field_id
* The field ID.
* The field ID.
*
*
* @return
* @return
\Drupal\field\FieldInterface|null
* The field
definition
, or NULL if no field was found.
* The field
entity
, or NULL if no field was found.
*/
*/
public
function
getFieldById
(
$field_id
)
{
public
function
getFieldById
(
$field_id
)
{
// Read from the "static" cache.
// Read from the "static" cache.
...
@@ -386,13 +386,13 @@ public function getFieldById($field_id) {
...
@@ -386,13 +386,13 @@ public function getFieldById($field_id) {
* The function also populates the corresponding field definitions in the
* The function also populates the corresponding field definitions in the
* "static" cache.
* "static" cache.
*
*
* @param $entity_type
* @param
string
$entity_type
* The entity type.
* The entity type.
* @param $bundle
* @param
string
$bundle
* The bundle name.
* The bundle name.
*
*
* @return
* @return
\Drupal\field\FieldInstanceInterface[]
*
The
array of instance
defin
iti
on
s, keyed by field name.
*
An
array of
field
instance
ent
iti
e
s, keyed by field name.
*/
*/
public
function
getBundleInstances
(
$entity_type
,
$bundle
)
{
public
function
getBundleInstances
(
$entity_type
,
$bundle
)
{
// Read from the "static" cache.
// Read from the "static" cache.
...
@@ -496,7 +496,7 @@ public function getBundleInstances($entity_type, $bundle) {
...
@@ -496,7 +496,7 @@ public function getBundleInstances($entity_type, $bundle) {
}
}
/**
/**
* Returns a
n array of instance data for a specific field and bundl
e.
* Returns a
field instanc
e.
*
*
* @param string $entity_type
* @param string $entity_type
* The entity type for the instance.
* The entity type for the instance.
...
@@ -505,9 +505,8 @@ public function getBundleInstances($entity_type, $bundle) {
...
@@ -505,9 +505,8 @@ public function getBundleInstances($entity_type, $bundle) {
* @param string $field_name
* @param string $field_name
* The field name for the instance.
* The field name for the instance.
*
*
* @return array
* @return \Drupal\field\FieldInstanceInterface|null
* An associative array of instance data for the specific field and bundle;
* The field instance entity, or NULL if it does not exist.
* NULL if the instance does not exist.
*/
*/
function
getInstance
(
$entity_type
,
$bundle
,
$field_name
)
{
function
getInstance
(
$entity_type
,
$bundle
,
$field_name
)
{
$info
=
$this
->
getBundleInstances
(
$entity_type
,
$bundle
);
$info
=
$this
->
getBundleInstances
(
$entity_type
,
$bundle
);
...
@@ -519,12 +518,12 @@ function getInstance($entity_type, $bundle, $field_name) {
...
@@ -519,12 +518,12 @@ function getInstance($entity_type, $bundle, $field_name) {
/**
/**
* Retrieves the "extra fields" for a bundle.
* Retrieves the "extra fields" for a bundle.
*
*
* @param $entity_type
* @param
string
$entity_type
* The entity type.
* The entity type.
* @param $bundle
* @param
string
$bundle
* The bundle name.
* The bundle name.
*
*
* @return
* @return
array
* The array of extra fields.
* The array of extra fields.
*/
*/
public
function
getBundleExtraFields
(
$entity_type
,
$bundle
)
{
public
function
getBundleExtraFields
(
$entity_type
,
$bundle
)
{
...
@@ -555,13 +554,13 @@ public function getBundleExtraFields($entity_type, $bundle) {
...
@@ -555,13 +554,13 @@ public function getBundleExtraFields($entity_type, $bundle) {
}
}
/**
/**
* Prepares a field
definition
for the current run-time context.
* Prepares a field for the current run-time context.
*
*
* @param $field
* @param
\Drupal\field\FieldInterface
$field
* The
raw
field
structure as read from the databas
e.
* The field
entity to updat
e.
*
*
* @return
* @return
\Drupal\field\FieldInterface
* The field
definition completed for the current runtime context
.
* The field
that was prepared
.
*/
*/
public
function
prepareField
(
FieldInterface
$field
)
{
public
function
prepareField
(
FieldInterface
$field
)
{
// Make sure all expected field settings are present.
// Make sure all expected field settings are present.
...
@@ -571,13 +570,13 @@ public function prepareField(FieldInterface $field) {
...
@@ -571,13 +570,13 @@ public function prepareField(FieldInterface $field) {
}
}
/**
/**
* Prepares a
n
instance
definition
for the current run-time context.
* Prepares a
field
instance for the current run-time context.
*
*
* @param \Drupal\field\FieldInstanceInterface $instance
* @param \Drupal\field\FieldInstanceInterface $instance
* The instance
definition
.
* The
field
instance
entity to prepare
.
*
*
* @return
* @return
\Drupal\field\FieldInstanceInterface
* The field instance
array completed for the current runtime context
.
* The field instance
that was prepared
.
*/
*/
public
function
prepareInstance
(
FieldInstanceInterface
$instance
)
{
public
function
prepareInstance
(
FieldInstanceInterface
$instance
)
{
// Make sure all expected instance settings are present.
// Make sure all expected instance settings are present.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment