Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. AbstractNormalizer.php

function AbstractNormalizer::isAllowedAttribute

Is this attribute allowed?

9 calls to AbstractNormalizer::isAllowedAttribute()
AbstractNormalizer::getAllowedAttributes in vendor/symfony/serializer/Normalizer/AbstractNormalizer.php
Gets attributes to normalize using groups.
AbstractNormalizer::instantiateObject in vendor/symfony/serializer/Normalizer/AbstractNormalizer.php
Instantiates an object using constructor parameters when needed.
AbstractObjectNormalizer::denormalize in vendor/symfony/serializer/Normalizer/AbstractObjectNormalizer.php
Denormalizes data back into an object of the given class.
GetSetMethodNormalizer::isAllowedAttribute in vendor/symfony/serializer/Normalizer/GetSetMethodNormalizer.php
Is this attribute allowed?
GetSetMethodNormalizer::isAllowedAttribute in vendor/symfony/serializer/Normalizer/GetSetMethodNormalizer.php
Is this attribute allowed?

... See full list

3 methods override AbstractNormalizer::isAllowedAttribute()
GetSetMethodNormalizer::isAllowedAttribute in vendor/symfony/serializer/Normalizer/GetSetMethodNormalizer.php
Is this attribute allowed?
ObjectNormalizer::isAllowedAttribute in vendor/symfony/serializer/Normalizer/ObjectNormalizer.php
Is this attribute allowed?
PropertyNormalizer::isAllowedAttribute in vendor/symfony/serializer/Normalizer/PropertyNormalizer.php
Is this attribute allowed?

File

vendor/symfony/serializer/Normalizer/AbstractNormalizer.php, line 263

Class

AbstractNormalizer
Normalizer implementation.

Namespace

Symfony\Component\Serializer\Normalizer

Code

protected function isAllowedAttribute(object|string $classOrObject, string $attribute, ?string $format = null, array $context = []) : bool {
    $ignoredAttributes = $context[self::IGNORED_ATTRIBUTES] ?? $this->defaultContext[self::IGNORED_ATTRIBUTES];
    if (\in_array($attribute, $ignoredAttributes, true)) {
        return false;
    }
    $attributes = $context[self::ATTRIBUTES] ?? $this->defaultContext[self::ATTRIBUTES] ?? null;
    if (isset($attributes[$attribute])) {
        // Nested attributes
        return true;
    }
    if (\is_array($attributes)) {
        return \in_array($attribute, $attributes, true);
    }
    return true;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal