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

[FAQ] Override default Kirbytext Image tag #2

@bnomei

Description

@bnomei

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);
        }
    ]
]

Metadata

Metadata

Assignees

Labels

FAQenhancementNew feature or requestwontfixThis will not be worked on

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions