You are here

public function MenuLinkTreeNormalizer::normalize in Menu Normalizer 8

Same name and namespace in other branches
  1. 2.x src/Normalizer/MenuLinkTreeNormalizer.php \Drupal\menu_normalizer\Normalizer\MenuLinkTreeNormalizer::normalize()

File

src/Normalizer/MenuLinkTreeNormalizer.php, line 18

Class

MenuLinkTreeNormalizer
MenuLinkTreeElement Normalizer.

Namespace

Drupal\menu_normalizer\Normalizer

Code

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(),
  ];
}