function QuickEditEntityFieldAccessCheck::validateRequestAttributes

Same name in other branches
  1. 9 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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.