You are here

public function MenuLinkNormalizer::normalize in Menu Normalizer 8

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

File

src/Normalizer/MenuLinkNormalizer.php, line 18

Class

MenuLinkNormalizer
MenuLinkTreeElement Normalizer.

Namespace

Drupal\menu_normalizer\Normalizer

Code

public function normalize($object, $format = NULL, array $context = array()) {
  return [
    'weight' => $object
      ->getWeight(),
    'title' => $object
      ->getTitle(),
    'description' => $object
      ->getDescription(),
    'menu_name' => $object
      ->getMenuName(),
    'provider' => $object
      ->getProvider(),
    'parent' => $object
      ->getParent(),
    'enabled' => $object
      ->isEnabled(),
    'expanded' => $object
      ->isExpanded(),
    'resettable' => $object
      ->isResettable(),
    'translatable' => $object
      ->isTranslatable(),
    'deletable' => $object
      ->isDeletable(),
    'route_name' => $object
      ->getRouteName(),
    'route_parameters' => $object
      ->getRouteParameters(),
    'url' => $object
      ->getUrlObject()
      ->toString(),
    'options' => $object
      ->getOptions(),
    'meta_data' => $this->serializer
      ->normalize($object
      ->getMetaData(), $format, $context),
    'delete_route' => $object
      ->getDeleteRoute(),
    'edit_route' => $object
      ->getEditRoute(),
  ];
}