Skip to content
Snippets Groups Projects
Unverified Commit 94f1d433 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3441434 by kunal.sachdev, narendrar, omkar.podey, bbrala, wim leers,...

Issue #3441434 by kunal.sachdev, narendrar, omkar.podey, bbrala, wim leers, catch, smustgrave, yash.rode, alexpott: Add validation constraints to core.menu.schema.yml
parent 10a80a91
No related branches found
No related tags found
No related merge requests found
Pipeline #476515 passed with warnings
Pipeline: drupal

#476541

    Pipeline: drupal

    #476536

      Pipeline: drupal

      #476518

        core.menu.static_menu_link_overrides:
        type: config_object
        label: 'Static menu link overrides'
        constraints:
        FullyValidatable: ~
        mapping:
        definitions:
        type: sequence
        ......@@ -12,9 +14,24 @@ core.menu.static_menu_link_overrides:
        menu_name:
        type: string
        label: 'Menu name'
        # This is the id of system.menu.* config.
        # @see core/modules/system/config/schema/system.schema.yml
        ConfigExists:
        prefix: 'system.menu.'
        parent:
        type: string
        label: 'Parent'
        # Menu link plugins specify the empty string if there is no parent.
        # So this can be an empty string('') or valid menu link plugin ID.
        # @see \Drupal\Core\Menu\MenuLinkInterface::getParent()
        constraints:
        AtLeastOneOf:
        constraints:
        - PluginExists:
        manager: plugin.manager.menu.link
        interface: 'Drupal\Core\Menu\MenuLinkInterface'
        - IdenticalTo:
        value: ''
        weight:
        type: weight
        label: 'Weight'
        ......
        ......@@ -12,6 +12,7 @@
        use Symfony\Component\Validator\Constraints\Blank;
        use Symfony\Component\Validator\Constraints\Callback;
        use Symfony\Component\Validator\Constraints\Choice;
        use Symfony\Component\Validator\Constraints\IdenticalTo;
        use Symfony\Component\Validator\Constraints\Image;
        use Symfony\Component\Validator\Constraints\NotBlank;
        ......@@ -122,6 +123,11 @@ public function registerDefinitions() {
        'class' => Image::class,
        'type' => ['string'],
        ]);
        $this->getDiscovery()->setDefinition('IdenticalTo', [
        'label' => new TranslatableMarkup('IdenticalTo'),
        'class' => IdenticalTo::class,
        'type' => FALSE,
        ]);
        }
        /**
        ......
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Please register or to comment