We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e50dbfd commit db43b81Copy full SHA for db43b81
src/TwigComponent/src/AttributeBag.php
@@ -80,4 +80,23 @@ public function reject(string ...$keys): self
80
81
return $clone;
82
}
83
+
84
+ /**
85
+ * @param array<string, string> $attributes
86
+ */
87
+ public function defaults(array $attributes): self
88
+ {
89
+ $clone = $this;
90
91
+ foreach ($attributes as $attribute => $value) {
92
+ $clone->attributes[$attribute] = $clone->attributes[$attribute] ?? $value;
93
+ }
94
95
+ return $clone;
96
97
98
+ public function default(string $attribute, string $value): self
99
100
+ return $this->defaults([$attribute => $value]);
101
102
0 commit comments