Skip to content

Commit f1c87e0

Browse files
Merge pull request #6 from fabianmichael/develop
Develop
2 parents 5f01021 + dacd248 commit f1c87e0

File tree

5 files changed

+1026
-258
lines changed

5 files changed

+1026
-258
lines changed

README.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,24 @@ You can also use named arguments if you prefer a leaner syntax. Be aware, that t
4343
) ?>>
4444
```
4545

46-
⚠️ If you need XML-compatible attributes, always call `$attributes->toXml()` instead of just echoing the `Attributes` object,
47-
because otherwise all attributes will be converted to lower-case.
46+
Or if all you have is an attributes string, you can also feed the that to the `attributes()` helper:
47+
48+
```php
49+
<?php
50+
51+
// get image dimensions as height="yyy" width="xxx"
52+
$src = 'img.png';
53+
$size = getimagesize($src)[3];
54+
55+
?>
56+
57+
<img <?= attributes($size)->merge([
58+
'src' => $src,
59+
'alt' => '',
60+
]) ?>>
61+
```
62+
63+
⚠️ If you need XML-compatible attributes, always call `$attributes->toXml()` instead of just echoing the `Attributes` object, because otherwise all attributes will be converted to lower-case.
4864

4965
In many cases, you need to set different classes. The `classes()` helper is a nice shortcut for improved readability:
5066

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"homepage": "https://github.com/fabianmichael/kirby-template-attributes",
55
"license": "MIT",
66
"type": "kirby-plugin",
7-
"version": "2.2.0",
7+
"version": "2.3.0",
88
"authors": [
99
{
1010
"name": "Fabian Michael",
@@ -20,7 +20,8 @@
2020
"squizlabs/php_codesniffer": "^3.9"
2121
},
2222
"require": {
23-
"getkirby/composer-installer": "^1.2"
23+
"getkirby/composer-installer": "^1.2",
24+
"ext-dom": "*"
2425
},
2526
"autoload": {
2627
"psr-4": {

0 commit comments

Comments
 (0)