Git Product home page Git Product logo

drupal-crumbs's Introduction

This text is horribly out of date, especially for the 2.x branch ...


The ultimate breadcrumbs solution. Powerful, flexible, and as simple and DRY as can be.
(code will come soon)

Breadcrumbs based on:
- menus
- taxonomy
- system path fragments
- existing path alias fragments
- not yet existent pathauto alias fragments
- organic groups
- forum paths

Features:
- easy to extend.
- admin form to rearrange rules. no further configuration needed.
- guaranteed consistency: If d's breadcrumb is "a > b > c > d", then d's breadcrumb is "a > b > c".
- infinite loop prevention.

Requirements:
- PHP 5.2

How it works:
A plugin is an object that takes a path and returns a parent path.
If the rule returns NULL, the next rule is tried.

This process is repeated with the parent path, until either
- no further parent can be found.
- the returned path is the frontpage.
- the path is its own parent path.
- there is a loop consisting of more than one path.

In addition, every rule object has a chance to set a different title for a breadcrumb item (default is obtained from core menu system), or to let the item be skipped in the trail.











drupal-crumbs's People

Contributors

bojanz avatar donquixote avatar vasike avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

jawiweb

drupal-crumbs's Issues

Crumbs 7.x-3.x planned changes

This is a meta-issue used to publish planned changes for crumbs-7.x-2.x.
https://github.com/donquixote/drupal-crumbs/tree/7.x-3.x-rewrite-2
(Attention: I might rebase some of this / rewrite the git history.)

The good news: A lot of this is already implemented!

UI changes:

  • Plugin weights and status:
    • Checkbox tree instead of the drag+drop weights.
    • Separate forms for parent-finding and title-finding.
    • Integrate the "disabled by default" into the regular checkbox.
    • Considering to hide/eliminate the first level. So you can no longer control weights or status for e.g. menu.*, but only menu.hierarchy.*.
    • Now every "node in the tree" has a human-readable description, at least for the native plugins. This is possible thanks to API changes below.
  • Complete redesign of the debug page:
    • Instead of the huge table that tries to show everything, it now has separate widgets for different phases.
    • Also covers things outside the parent-finding / title-finding, that might affect the breadcrumb. E.g. whether some items are removed due to visibility settings.

API changes:

  • hook_crumbs_plugins()
    • still backwards compatible.
    • still in flux.
    • fluent interface / method-chaining
    • Use the ->pluginFamily($key) method to group plugins together.
    • Easier to add descriptions to every node in the tree.
    • Still undecided: Strict separation of title-finding and parent-finding within hook_crumbs_plugins().
    • Still undecided: Separate hooks for hook_crumbs_parent_plugins() and hook_crumbs_title_plugins() ?
    • Still undecided: Special fluent stuff for route-specific plugins, like $api->route('taxonomy/term/%')->monoPlugin(..);. I already implemented this, but I am now thinking that it unnecessarily bloats the classes
  • Crumbs plugins
    • Magic naming of plugin classes deprecated, but still supported.
    • Magic naming of plugin methods like findParent__node_x() is now deprecated, but still supported with a legacy wrapper.
  • NEW: Breadcrumb formatters!
    • not implemented yet
    • Allows to display the breadcrumb with a different "formatter" depending on the context.
    • Will make it easy to implement SEO-friendly breadcrumbs, without disrupting themes that don't support it.
    • Will be based on render array altering.

Code/architecture changes:

  • Using PSR-4 (with xautoload dependency).
    • Some code is still leftover with PEAR-FLAT (that's the pseudo-convention we used before)
  • Clean up a lot of confusing code that was too creative for its own good.
  • Separate UI module.
    • Object-oriented page controllers.
    • Object-oriented forms and form elements.
    • Still undecided: Factor some of this out into a separate module, published as a separate project on drupal.org, maybe named uikit.
  • generate.php to mirror code from parent-finding over to title-finding.
    • I plan to make add a unit test to check if generate.php has run.

Still missing:

  • All the caching stuff has been removed for now, and will be added when things stabilize.
  • I am sure some code can be further simplified. In some places there are still too many classes without clearly distinct responsibility.
  • Breadcrumb formatters, as mentioned above.

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.