You are here

protected function QuickEditEntityFieldAccessCheck::validateRequestAttributes in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/quickedit/src/Access/QuickEditEntityFieldAccessCheck.php \Drupal\quickedit\Access\QuickEditEntityFieldAccessCheck::validateRequestAttributes()
  2. 10 core/modules/quickedit/src/Access/QuickEditEntityFieldAccessCheck.php \Drupal\quickedit\Access\QuickEditEntityFieldAccessCheck::validateRequestAttributes()

Validates request attributes.

1 call to QuickEditEntityFieldAccessCheck::validateRequestAttributes()
QuickEditEntityFieldAccessCheck::access in core/modules/quickedit/src/Access/QuickEditEntityFieldAccessCheck.php
Checks Quick Edit access to the field.

File

core/modules/quickedit/src/Access/QuickEditEntityFieldAccessCheck.php, line 50

Class

QuickEditEntityFieldAccessCheck
Access check for in-place editing entity fields.

Namespace

Drupal\quickedit\Access

Code

protected function validateRequestAttributes(EntityInterface $entity, $field_name, $langcode) {

  // Validate the field name and language.
  if (!$field_name || !$entity
    ->hasField($field_name)) {
    return FALSE;
  }
  if (!$langcode || !$entity
    ->hasTranslation($langcode)) {
    return FALSE;
  }
  return TRUE;
}