diff --git a/core/modules/entity/lib/Drupal/entity/Entity/EntityFormDisplay.php b/core/modules/entity/lib/Drupal/entity/Entity/EntityFormDisplay.php index d37799f..563c60b 100644 --- a/core/modules/entity/lib/Drupal/entity/Entity/EntityFormDisplay.php +++ b/core/modules/entity/lib/Drupal/entity/Entity/EntityFormDisplay.php @@ -166,11 +166,6 @@ public function buildForm(ContentEntityInterface $entity, array &$form, array &$ $form[$name]['#weight'] = $options['weight']; } } - - // @todo hook_field_attach_form() ? - // We still need a hook to allow alteration of "forms with widgets", because - // the regular "entity form" alter hook won't run non "non enity forms"... - // Although, there's already hook_field_widget_form_alter() to alter each widget ? } /** @@ -178,15 +173,12 @@ public function buildForm(ContentEntityInterface $entity, array &$form, array &$ */ public function extractFormValues(ContentEntityInterface $entity, array &$form, array &$form_state) { $extracted = array(); - foreach ($entity as $name => $items) { if ($widget = $this->getRenderer($name)) { $widget->extractFormValues($items, $form, $form_state); $extracted[$name] = $name; } } - // @todo hook_field_attach_extract_form_values() ? - See above. - return $extracted; } diff --git a/core/modules/field/field.api.php b/core/modules/field/field.api.php index 08d10d8..868f40c 100644 --- a/core/modules/field/field.api.php +++ b/core/modules/field/field.api.php @@ -293,78 +293,6 @@ function hook_field_formatter_info_alter(array &$info) { */ /** - * @addtogroup field_attach - * @{ - */ - -/** - * Act on field_attach_form(). - * - * This hook is invoked after the field module has performed the operation. - * Implementing modules should alter the $form or $form_state parameters. - * - * @param \Drupal\Core\Entity\EntityInterface $entity - * The entity for which an edit form is being built. - * @param $form - * The form structure field elements are attached to. This might be a full - * form structure, or a sub-element of a larger form. The $form['#parents'] - * property can be used to identify the corresponding part of - * $form_state['values']. Hook implementations that need to act on the - * top-level properties of the global form (like #submit, #validate...) can - * add a #process callback to the array received in the $form parameter, and - * act on the $complete_form parameter in the process callback. - * @param $form_state - * An associative array containing the current state of the form. - * @param $langcode - * The language the field values are going to be entered in. If no language is - * provided the default site language will be used. - * - * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0. - * Use the entity system instead, see https://drupal.org/developing/api/entity - */ -function hook_field_attach_form(\Drupal\Core\Entity\EntityInterface $entity, &$form, &$form_state, $langcode) { - // Add a checkbox allowing a given field to be emptied. - // See hook_field_attach_extract_form_values() for the corresponding - // processing code. - $form['empty_field_foo'] = array( - '#type' => 'checkbox', - '#title' => t("Empty the 'field_foo' field"), - ); -} - -/** - * Act on field_attach_extract_form_values(). - * - * This hook is invoked after the field module has performed the operation. - * - * @param \Drupal\Core\Entity\EntityInterface $entity - * The entity for which an edit form is being submitted. The incoming form - * values have been extracted as field values of the $entity object. - * @param $form - * The form structure field elements are attached to. This might be a full - * form structure, or a sub-part of a larger form. The $form['#parents'] - * property can be used to identify the corresponding part of - * $form_state['values']. - * @param $form_state - * An associative array containing the current state of the form. - * - * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0. - * Use the entity system instead, see https://drupal.org/developing/api/entity - */ -function hook_field_attach_extract_form_values(\Drupal\Core\Entity\EntityInterface $entity, $form, &$form_state) { - // Sample case of an 'Empty the field' checkbox added on the form, allowing - // a given field to be emptied. - $values = NestedArray::getValue($form_state['values'], $form['#parents']); - if (!empty($values['empty_field_foo'])) { - unset($entity->field_foo); - } -} - -/** - * @} End of "addtogroup field_attach". - */ - -/** * Returns the maximum weight for the entity components handled by the module. * * Field API takes care of fields and 'extra_fields'. This hook is intended for