diff --git a/core/modules/field/field.attach.inc b/core/modules/field/field.attach.inc index 1ca43e0..5b7f2db 100644 --- a/core/modules/field/field.attach.inc +++ b/core/modules/field/field.attach.inc @@ -114,8 +114,8 @@ const FIELD_STORAGE_INSERT = 'insert'; * * @param string $method * The name of the method to invoke. - * @param Closure $target - * A closure that receives an $instance object and returns the object on + * @param callable $target_function + * A function that receives an $instance object and returns the object on * which the method should be invoked. * @param Drupal\Core\Entity\EntityInterface $entity * The fully formed $entity_type entity. @@ -143,7 +143,7 @@ const FIELD_STORAGE_INSERT = 'insert'; * @return array * An array of returned values. */ -function field_invoke_method($method, \Closure $target_closure, EntityInterface $entity, &$a = NULL, &$b = NULL, array $options = array()) { +function field_invoke_method($method, $target_function, EntityInterface $entity, &$a = NULL, &$b = NULL, array $options = array()) { // Merge default options. $default_options = array( 'deleted' => FALSE, @@ -161,7 +161,7 @@ function field_invoke_method($method, \Closure $target_closure, EntityInterface // Let the closure determine the target object on which the method should be // called. - $target = $target_closure($instance); + $target = $target_function($instance); if (method_exists($target, $method)) { $field = field_info_field_by_id($instance['field_id']); @@ -204,8 +204,8 @@ function field_invoke_method($method, \Closure $target_closure, EntityInterface * * @param string $method * The name of the method to invoke. - * @param Closure $target - * A closure that receives an $instance object and returns the object on + * @param callable $target_function + * A function that receives an $instance object and returns the object on * which the method should be invoked. * @param array $entities * An array of entities, keyed by entity ID. @@ -235,7 +235,7 @@ function field_invoke_method($method, \Closure $target_closure, EntityInterface * * @see field_invoke_method() */ -function field_invoke_method_multiple($method, \Closure $target, array $entities, &$a = NULL, &$b = NULL, array $options = array()) { +function field_invoke_method_multiple($method, $target_function, array $entities, &$a = NULL, &$b = NULL, array $options = array()) { // Merge default options. $default_options = array( 'deleted' => FALSE, @@ -246,7 +246,7 @@ function field_invoke_method_multiple($method, \Closure $target, array $entities $instances = array(); $grouped_entities = array(); $grouped_items = array(); - $grouped_objects = array(); + $grouped_targets = array(); $return = array(); // Go through the entities and collect the instances on which the method @@ -264,11 +264,11 @@ function field_invoke_method_multiple($method, \Closure $target, array $entities // Let the closure determine the target object on which the method should // be called. - if (empty($grouped_objects[$instance_id])) { - $grouped_objects[$instance_id] = $target($instance); + if (empty($grouped_targets[$instance_id])) { + $grouped_targets[$instance_id] = $target_function($instance); } - if (method_exists($grouped_objects[$instance_id], $method)) { + if (method_exists($grouped_targets[$instance_id], $method)) { // Add the instance to the list of instances to invoke the hook on. if (!isset($instances[$instance_id])) { $instances[$instance_id] = $instance; @@ -298,7 +298,7 @@ function field_invoke_method_multiple($method, \Closure $target, array $entities // Iterate over all the field translations. foreach ($grouped_items[$instance_id] as $langcode => &$items) { $entities = $grouped_entities[$instance_id][$langcode]; - $results = $grouped_objects[$instance_id]->$method($entities, $langcode, $items, $a, $b); + $results = $grouped_targets[$instance_id]->$method($entities, $langcode, $items, $a, $b); if (isset($results)) { // Collect results by entity. diff --git a/core/modules/field/field.module b/core/modules/field/field.module index 9d74dc9..68afafa 100644 --- a/core/modules/field/field.module +++ b/core/modules/field/field.module @@ -755,39 +755,6 @@ function field_view_mode_settings($entity_type, $bundle) { } /** - * Returns the display settings to use for an instance in a given view mode. - * - * @param $instance - * The field instance being displayed. - * @param $view_mode - * The view mode. - * @param $entity - * The entity being displayed. - * - * @return - * The display settings to be used when displaying the field values. - */ -function field_get_display($instance, $view_mode, $entity) { - // Check whether the view mode uses custom display settings or the 'default' - // mode. - $view_mode_settings = field_view_mode_settings($instance['entity_type'], $instance['bundle']); - $actual_mode = (!empty($view_mode_settings[$view_mode]['custom_settings']) ? $view_mode : 'default'); - $display = $instance['display'][$actual_mode]; - - // Let modules alter the display settings. - $context = array( - 'entity_type' => $instance['entity_type'], - 'field' => field_info_field($instance['field_name']), - 'instance' => $instance, - 'entity' => $entity, - 'view_mode' => $view_mode, - ); - drupal_alter(array('field_display', 'field_display_' . $instance['entity_type']), $display, $context); - - return $display; -} - -/** * Returns the display settings to use for pseudo-fields in a given view mode. * * @param $entity_type diff --git a/core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterBase.php b/core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterBase.php index aceca43..5a23fa4 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterBase.php +++ b/core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterBase.php @@ -62,7 +62,7 @@ abstract class FormatterBase extends PluginSettingsBase implements FormatterInte /** * Constructs a FormatterBase object. * - * @param array $plugin_id + * @param string $plugin_id * The plugin_id for the formatter. * @param Drupal\Component\Plugin\Discovery\DiscoveryInterface $discovery * The Discovery class that holds access to the formatter implementation diff --git a/core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterInterface.php b/core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterInterface.php index 215e595..cf52530 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterInterface.php +++ b/core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterInterface.php @@ -34,7 +34,7 @@ interface FormatterInterface extends PluginSettingsInterface { public function settingsForm(array $form, array &$form_state); /** - * Return a short summary for the current formatter settings. + * Returns a short summary for the current formatter settings. * * If an empty result is returned, the formatter is assumed to have no * configurable settings, and no UI will be provided to display a settings @@ -46,7 +46,7 @@ interface FormatterInterface extends PluginSettingsInterface { public function settingsSummary(); /** - * Allow formatters to load information for field values being displayed. + * Allows formatters to load information for field values being displayed. * * This should be used when a formatter needs to load additional information * from the database in order to render a field, for example a reference