You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Generate your component files as you are used to, then add the `Whitecube\BemComponents\HasBemClasses` trait to their controller class in `App\View\Components`:
15
+
Generate your component files as you are used to, then add the `Whitecube\BemComponents\HasBemClasses` trait to the component's view controller in `App\View\Components`:
Checks if the specified modifier is applied on this component.
109
+
Checks if the specified `modifier` is applied on this component.
110
110
111
-
> Warning: this method is also available inside the `Component` instance (using `$this->hasModifier(string $modifier)`) but unfortunately it is not able to check for modifiers defined as attributes on the component's tag (`<x-component modifiers="foo bar" />`) as of Laravel 10.x, because these values are not exposed before rendering the component's view. Let's hope this restriction will be lifted in the future.
111
+
> [!IMPORTANT]
112
+
> This method is also available inside the `Component` instance (using `$this->hasModifier(string $modifier)`) but unfortunately it is not able to check for modifiers defined as attributes on the component's tag (`<x-component modifiers="foo bar" />`) as of Laravel 10.x, because these values are not exposed before rendering the component's view. Let's hope this restriction will be lifted in the future.
112
113
113
114
If you need to access these modifiers inside the `Component` instance, you can always request them from the component's `__construct` parameters and inject them manually:
114
115
@@ -128,9 +129,10 @@ public function __construct(null|string|array $modifiers = [])
128
129
129
130
#### `$hasClass(string $classname): bool`
130
131
131
-
Checks if the specified class is applied on this component.
132
+
Checks if the specified CSS classname is applied on this component.
132
133
133
-
> Warning: this method is also available inside the `Component` instance (using `$this->hasClass(string $classname)`) but unfortunately it is not able to check for classnames defined as attributes on the component's tag (`<x-component class="foo bar" />`) as of Laravel 10.x, because these values are not exposed before rendering the component's view. Let's hope this restriction will be lifted in the future.
134
+
> [!IMPORTANT]
135
+
> This method is also available inside the `Component` instance (using `$this->hasClass(string $classname)`) but unfortunately it is not able to check for classnames defined as attributes on the component's tag (`<x-component class="foo bar" />`) as of Laravel 10.x, because these values are not exposed before rendering the component's view. Let's hope this restriction will be lifted in the future.
134
136
135
137
If you need to access these classnames inside the `Component` instance, you can always request them from the component's `__construct` parameters and inject them manually:
0 commit comments