Commit ca560672 authored by catch's avatar catch

Issue #2151699 by jsbalsera: Move #access responsibility from...

Issue #2151699 by jsbalsera: Move #access responsibility from formatters/widgets to EntityViewDisplay/EntityFormDisplay.
parent 973948ed
......@@ -79,7 +79,6 @@ public function view(FieldItemListInterface $items) {
$info = array(
'#theme' => 'field',
'#title' => $this->fieldDefinition->getLabel(),
'#access' => $items->access('view'),
'#label_display' => $this->label,
'#view_mode' => $this->viewMode,
'#language' => $items->getLangcode(),
......
......@@ -123,7 +123,6 @@ public function form(FieldItemListInterface $items, array &$form, array &$form_s
'field-widget-' . drupal_html_class($this->getPluginId()),
),
),
'#access' => $items->access('edit'),
'widget' => $elements,
);
}
......
......@@ -157,6 +157,7 @@ public function buildForm(ContentEntityInterface $entity, array &$form, array &$
if ($widget = $this->getRenderer($name)) {
$items->filterEmptyItems();
$form[$name] = $widget->form($items, $form, $form_state);
$form[$name]['#access'] = $items->access('edit');
// Assign the correct weight. This duplicates the reordering done in
// processForm(), but is needed for other forms calling this method
......
......@@ -231,6 +231,7 @@ public function buildMultiple(array $entities) {
foreach ($entities as $key => $entity) {
$items = $entity->get($field_name);
$build[$key][$field_name] = $formatter->view($items);
$build[$key][$field_name]['#access'] = $items->access('view');
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment