class MenuLinkNormalizer in Menu Normalizer 8
Same name and namespace in other branches
- 2.x src/Normalizer/MenuLinkNormalizer.php \Drupal\menu_normalizer\Normalizer\MenuLinkNormalizer
MenuLinkTreeElement Normalizer.
Hierarchy
- class \Drupal\serialization\Normalizer\NormalizerBase implements \Symfony\Component\Serializer\SerializerAwareInterface, CacheableNormalizerInterface uses \Symfony\Component\Serializer\SerializerAwareTrait- class \Drupal\menu_normalizer\Normalizer\MenuLinkNormalizer
 
Expanded class hierarchy of MenuLinkNormalizer
1 string reference to 'MenuLinkNormalizer'
1 service uses MenuLinkNormalizer
File
- src/Normalizer/ MenuLinkNormalizer.php, line 10 
Namespace
Drupal\menu_normalizer\NormalizerView source
class MenuLinkNormalizer extends NormalizerBase {
  protected $supportedInterfaceOrClass = 'Drupal\\Core\\Menu\\MenuLinkInterface';
  /**
   * {@inheritdoc}
   */
  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(),
    ];
  }
}Members
| Name   | Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| CacheableNormalizerInterface:: | constant | Name of key for bubbling cacheability metadata via serialization context. | ||
| MenuLinkNormalizer:: | protected | property | The interface or class that this Normalizer supports. Overrides NormalizerBase:: | |
| MenuLinkNormalizer:: | 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 | 
