Giter Site home page Giter Site logo

compiler pass for route filters about routing HOT 4 OPEN

dbu avatar dbu commented on September 18, 2024
compiler pass for route filters

from routing.

Comments (4)

dbu avatar dbu commented on September 18, 2024

@dawehner if you have too much time left after #97 this could be another cleanup. though much less important.

from routing.

dawehner avatar dawehner commented on September 18, 2024

In the meantime we abstracted that into http://cgit.drupalcode.org/drupal/tree/core/lib/Drupal/Core/DependencyInjection/Compiler/TaggedHandlersPass.php?id=refs/heads;id2=8.0.x

which allows you to specify a service to collect other services.
This would be the "collector" service:

  breadcrumb:
    class: Drupal\Core\Breadcrumb\BreadcrumbManager
    arguments: ['@module_handler']
    tags:
      - { name: service_collector, tag: breadcrumb_builder, call: addBuilder }

and then you do something like that in the client service:

  forum.breadcrumb.listing:
    class: Drupal\forum\Breadcrumb\ForumListingBreadcrumbBuilder
    arguments: ['@entity.manager', '@config.factory', '@forum_manager']
    tags:
      - { name: breadcrumb_builder, priority: 314 }

Do you think that this is something we could even push into symfony itself?

from routing.

dbu avatar dbu commented on September 18, 2024

@dawehner sorry for the late reply. are you proposing a generic way of doing compiler passes for tags? compiler passes can do all kind of things, but for the standard case of late-and-implicit hooking up services together, this seems a good idea to me. i would propose that to symfony and see if they like the idea. it seems a DX improvement to me. a variant of your proposal would be a generic compiler pass that the bundle can instantiate with the options about the receiving service and its add-method and the tag name - might be a tad more straightforward. (what would happen if we define several service collectors for the same tag?)

from routing.

dbu avatar dbu commented on September 18, 2024

feel free to ping me in the symfony/symfony issue to help with the discussion, btw.

from routing.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.