Comments (5)
Since parent is typed for MenuItemModelInterface we are a bit stuck..
You are the boss, not your tooling 😁
public function isDisabled(): bool
{
/** @var MenuItemModel $parent */
$parent = $this->getParent();
return $parent?->isDisabled() ?? $this->disabled;
}
or
public function isDisabled(): bool
{
$parent = $this->getParent();
if ($parent instanceof MenuItemModel) {
return $parent->isDisabled();
}
return $this->disabled;
}
from tablerbundle.
I don't have an answer, I can just tell you that I am using my own final class MenuItemModel implements MenuItemInterface
in my project. Which you could do as well, to support the raw HTML.
You know you can add blocks where it makes sense.
I am just not a fan of adding features, which are not part of Tabler itself.
We should instead push those changes upstream if somehow possible.
I am a contributor of the Tabler repo, so if you send reasonable PRs (instead of discussions) codecalm will likely merge it. Yes, he is not very responsive, which is fine (even though it can be annoying) ... it is still a free open source project. Give it a try and see what happens.
from tablerbundle.
Sorry for the late reply, I have been running after time lately ⏲️ 🏃
(instead of discussions)
Funny part is THEY convert issues into discussions.
I am using my own final class MenuItemModel implements MenuItemInterface in my project
So you have ovewrote the menu.twig.html
template?
I am just not a fan of adding features, which are not part of Tabler itself.
Agree for the separator
feature that I want.
Can we at least allow raw
?
Even today MenuItem has a $divider
option but not used for Tabler.
Which I think comes from AdminLTE.
TablerBundle/src/Model/MenuItemModel.php
Line 25 in 17b3640
from tablerbundle.
So you have ovewrote the menu.twig.html template?
No, only the model for more features.
Can we at least allow raw?
How? General rule of thumb is: whenever you have to use raw
there is something fishy going on 😁
Yes, there are legit use-cases, but not many. That |raw
filter produced quite some bugs in the past for me. It is always a (big) risk, when you do not think twice about source of the data...
Make a proposal, I am not against it, if there is a good and safe use-case.
Which I think comes from AdminLTE.
Yes, very likely 🙃
from tablerbundle.
Okay, so I might need an external eye to solve my case then:
How to add disabled
member of MenuItemModel
AND in the getter, checks if parent is also not already disabled.
Since parent is typed for MenuItemModelInterface we are a bit stuck..
use KevinPapst\TablerBundle\Model\MenuItemModel as TablerMenuItemModel;
class MenuItemModel extends TablerMenuItemModel
{
private bool $disabled = false;
public function isDisabled(): bool
{
// ❌ Polymorphic call => PhpStan will not allow that
return $this->getParent()?->isDisabled() ?? $this->disabled;
}
public function setDisabled(bool $disabled): void
{
$this->disabled = $disabled;
}
}
ATE, I think I need to rewrite the whole MenuItemModel, and menu.html.twig
to fit my needs
it is a dev problem and overwriting the template is a good way to go
from tablerbundle.
Related Issues (20)
- Component - Carousel HOT 3
- Include a Screenshot from the demo project in the project readme HOT 1
- Menu item allows `null` route name but not when rendered HOT 1
- Card embed block names HOT 5
- Update Tabler to beta15 HOT 2
- [Twig] File Name convention HOT 1
- [Button] `btn-sm` and `icon` class
- [Trans] Auto trans on devs content should not be a thing HOT 10
- [Twig] Rename all `url` params to `href`
- Support Symfony 7 in TablerBundle HOT 2
- release 1.0 HOT 2
- support ux components HOT 6
- Flash messages not displayed after redirectToRoute() HOT 9
- [Docs] Dynamic theme options (like dark mode) HOT 3
- Update to beta 20 HOT 1
- [Feature] Image Check Checkbox/Radio Inputs HOT 3
- [Icon] Bye bye `tabler_icon` ➡️ Welcome Symfony UX Icon 🎉 HOT 9
- [Help needed] How do I use this bundle with Symfony's new AssetMapper? HOT 1
- addChild() return void, docs show fluent setter
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tablerbundle.