class MenuLinkTreeNormalizer in Menu Normalizer 8
Same name and namespace in other branches
- 2.x src/Normalizer/MenuLinkTreeNormalizer.php \Drupal\menu_normalizer\Normalizer\MenuLinkTreeNormalizer
MenuLinkTreeElement Normalizer.
Hierarchy
- class \Drupal\serialization\Normalizer\NormalizerBase implements \Symfony\Component\Serializer\SerializerAwareInterface, CacheableNormalizerInterface uses \Symfony\Component\Serializer\SerializerAwareTrait
- class \Drupal\menu_normalizer\Normalizer\MenuLinkTreeNormalizer
Expanded class hierarchy of MenuLinkTreeNormalizer
1 string reference to 'MenuLinkTreeNormalizer'
1 service uses MenuLinkTreeNormalizer
File
- src/
Normalizer/ MenuLinkTreeNormalizer.php, line 10
Namespace
Drupal\menu_normalizer\NormalizerView source
class MenuLinkTreeNormalizer extends NormalizerBase {
protected $supportedInterfaceOrClass = 'Drupal\\Core\\Menu\\MenuLinkTreeElement';
/**
* {@inheritdoc}
*/
public function normalize($object, $format = NULL, array $context = array()) {
return [
'link' => $this->serializer
->normalize($object->link, $format, $context),
'has_children' => $object->hasChildren,
'depth' => $object->depth,
'in_active_trail' => $object->inActiveTrail,
'subtree' => $this->serializer
->normalize($object->subtree, $format, $context),
'count' => $object
->count(),
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CacheableNormalizerInterface:: |
constant | Name of key for bubbling cacheability metadata via serialization context. | ||
MenuLinkTreeNormalizer:: |
protected | property |
The interface or class that this Normalizer supports. Overrides NormalizerBase:: |
|
MenuLinkTreeNormalizer:: |
public | function | Normalizes an object into a set of arrays/scalars. | |
NormalizerBase:: |
protected | property | List of formats which supports (de-)normalization. | 3 |
NormalizerBase:: |
protected | function | Adds cacheability if applicable. | |
NormalizerBase:: |
protected | function | Checks if the provided format is supported by this normalizer. | 2 |
NormalizerBase:: |
public | function | Implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface::supportsDenormalization() | 1 |
NormalizerBase:: |
public | function | Checks whether the given class is supported for normalization by this normalizer. | 1 |