Skip to content
This repository has been archived by the owner on Feb 13, 2022. It is now read-only.

[FAQ] Override default Kirbytext Image tag #2

Open
bnomei opened this issue Aug 10, 2018 · 2 comments
Open

[FAQ] Override default Kirbytext Image tag #2

bnomei opened this issue Aug 10, 2018 · 2 comments
Assignees
Labels
enhancement New feature or request FAQ wontfix This will not be worked on

Comments

@bnomei
Copy link
Owner

bnomei commented Aug 10, 2018

Question
Override default Kibytext image tag

(image: myfile.jpg)

Answer
Overriding even just as an option might conflict with various other plugins.
Create a kirbytext:before hook and do a text replace if you really want this.
Or just use the srcset tag right from the start.

(srcset: myfile.jpg)
(srcset: myfile.jpg preset: breakpoints)
(srcset: myfile.jpg lazy: true)
(srcset: myfile.jpg preset: breakpoints lazy: true)

/site/config/config.php

return [
    'hooks' => [
        'kirbytags:before' => function ($text, $data, $options) {
            return str_replace('(image:', '(srcset:', $text);
        }
    ]
]
@bnomei bnomei added enhancement New feature or request wontfix This will not be worked on labels Aug 10, 2018
@bnomei bnomei self-assigned this Aug 10, 2018
@bnomei bnomei added the FAQ label Aug 10, 2018
@luxlogica
Copy link

Perhaps just adding the explanation of how to use the before hook directly to the docs would be sufficient. 👍

@bnomei bnomei pinned this issue Feb 6, 2019
@bnomei
Copy link
Owner Author

bnomei commented Aug 26, 2019

will be (lazysrcset: starting v3.0.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request FAQ wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants