creitive / breadcrumbs Goto Github PK
View Code? Open in Web Editor NEWA simple breadcrumbs package with Twitter Bootstrap-compatible output
License: MIT License
A simple breadcrumbs package with Twitter Bootstrap-compatible output
License: MIT License
http://getbootstrap.com/components/#breadcrumbs
As indicated in the URL above, Bootstrap now uses an ol-element with the class "breadcrumb" (singular) for the breadcrumbs-component. As far as I can tell, there are no config-options for changing the containing html tag in this package.
Do you plan on updating the package so that it is once again Bootstrap-compatible?
Thanks!
1️⃣ It should be nice if we can chain methods like:
<?php
$breadcrumbs->addCrumb('Home', '/')
->addCrumb('Pages', 'pages')
->addCrumb('Subpage', 'subpage')
->addCrumb('Subsubpage', '/subsubpage')
->addCrumb('Other website', 'http://otherwebsite.com/some-page');
?>
I think is not hard to implement, it just need return $this
in addCrumb
method.
2️⃣ And, maybe, refactorize addCrumb
name to add
(shortest name) or add it as an alias:
<?php
$breadcrumbs->add('Home', '/')
->add('Pages', 'pages')
->add('Subpage', 'subpage')
->add('Subsubpage', '/subsubpage')
->add('Other website', 'http://otherwebsite.com/some-page');
?>
We should have a config file where some default stuff like the listElement
can be configured, and the service provider will automatically set that on the shared instance, so that the users may change this stuff via a configuration setting, rather than having to manually set it in code.
Hi,
There is currently no way to configure classes for list items generated breadcrumbs. I don't think a PR is needed, but if your goal is to support bootstrap or other css frameworks, it might be helpful to add a setListItemClass
method similar to setCssClasses
so that you can add default classes to the actual list breadcrumb li
's.
For example, bootstrap 4 uses the following markup:
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#">Home</a></li>
<li class="breadcrumb-item"><a href="#">Library</a></li>
<li class="breadcrumb-item active">Data</li>
</ol>
Currently, the only class that is added to li
's is active
. I've manually added breadcrumb-item
in my copy of this, but I think others would appreciate this as an option.
Currently, the microdata markup generated thanks to #15 isn't mentioned anywhere in the documentation - but it would probably be useful for people to know about it, so we should add it somewhere to the README file.
When this library was created, Twitter Bootstrap was at version 2, so the default divider element /
was used. Twitter Bootstrap 3 uses pseudo elements for this, so it's not needed anymore, and should default to null
(so it isn't even rendered at all). We should also update the default breadcrumbs
class to be just breadcrumb
instead (which is the Bootstrap class in both 2 and 3 - not sure why we didn't use that from the start).
In fact, since pseudo-elements are the "correct" way to do this (there's nothing semantic about having a divider in HTML, at least in my opinion), we should likely just remove the divider functionality.
As both of these (removing dividers and changing the default CSS class) are BC breaks, we won't do this before v4.0.0. Not sure when that's gonna happen, but I'll let this issue stay here so we don't forget about it.
If anyone has any input on this (or a good argument on why it shouldn't be done), feel free to comment!
Hello,
In the render() method, we find http and not https. Could you modify or can we override the method and how?
Thanks
public function render()
{
if (empty($this->breadcrumbs)) {
return '';
}
$cssClasses = implode(' ', $this->breadcrumbsCssClasses);
return '<'. $this->listElement . ' itemscope itemtype="http://schema.org/BreadcrumbList"'
.' class="' . $cssClasses .'">'
. $this->renderCrumbs()
. '</'. $this->listElement .'>';
}
Problem 1
It would be helpful to show some simple "Best Practices" for using this plugin. I think I understand, in general, how it works, but it would be nice to see where the obvious places to put the components are. At least, it's not obvious to me where to put them.
I'm looking for where to place them to minimize duplication of code and simplify build-out.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.