commit 0897c827cd0b791e51992929dcae5967b4d46f09 Author: Wolfgang Ziegler // fago Date: Wed May 20 19:48:24 2015 +0200 Removes form #access checking. diff --git a/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php b/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php index f161a37..897048d 100644 --- a/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php +++ b/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php @@ -244,23 +244,6 @@ public function validateFormValues(FieldableEntityInterface $entity, array &$for } /** - * Returns whether the field is editable. - * - * @param array $form - * The form - * @param string $field_name - * The field name. - * - * @return \Drupal\Core\Field\WidgetInterface|NULL - * The widget or NULL. - */ - protected function getWidgetIfAccessible($form, $field_name) { - if (($widget = $this->getRenderer($field_name)) && (!isset($form[$field_name]['#access']) || $form[$field_name]['#access'])) { - return $widget; - } - } - - /** * {@inheritdoc} */ public function flagViolations(EntityConstraintViolationListInterface $violations, array &$form, FormStateInterface $form_state) { @@ -269,7 +252,7 @@ public function flagViolations(EntityConstraintViolationListInterface $violation $field_violations = $this->movePropertyPathViolationsRelativeToField($field_name, $violations->filterByField($field_name)); // Only show violations for fields that actually appear in the form, and // let the widget assign the violations to the correct form elements. - if ($widget = $this->getWidgetIfAccessible($form, $field_name)) { + if ($widget = $this->getRenderer($field_name)) { $widget->flagErrors($entity->get($field_name), $field_violations, $form, $form_state); } else { @@ -279,7 +262,7 @@ public function flagViolations(EntityConstraintViolationListInterface $violation foreach ($field_violations as $violation) { if ($violation instanceof ConstraintViolation && $violation->getConstraint() instanceof CompositeConstraintBase && $covered_fields = $violation->getConstraint()->coversFields()) { foreach ($covered_fields as $covered_field) { - if ($widget = $this->getWidgetIfAccessible($form, $covered_field)) { + if ($widget = $this->getRenderer($covered_field)) { $form_state->setErrorByName($covered_field, $this->t('The validation failed because the value conflicts with the value in %field_name, which you cannot access.', ['%field_name' => $field_name])); } }