Hi,
I would like to change all srcset() return. I know how to manipulate string in php.
I think this is with class and model, but how to do this for all pages ?
Can I overwrite the function or make my own $image->mysrcset()
?
Hi,
I would like to change all srcset() return. I know how to manipulate string in php.
I think this is with class and model, but how to do this for all pages ?
Can I overwrite the function or make my own $image->mysrcset()
?
I try :
<?php
Kirby::plugin('my/cdn', [
'filesMethods' => [
'srcset' => function() {
return '--------';
}
]
]);
This plugin does nothing.
You probably need to hook into the fileMethods
, and not the filesMethods
, as you are using this on 1 file $image
(and not on a collection of files).
Yes I try too⦠but nothing
See docs for:
Be aware that you cannot override these default file methods with any custom file method.
You probably need to rename your function. E.g.
<?php
Kirby::plugin('my/cdn', [
'fileMethods' => [
'mysrcset' => function() {
return '--------';
}
]
]);
Then use like: $image->mysrcset()
.
Work in progress
Kirby::plugin('my/cdn', [
'fileMethods' => [
'mysrcset' => function($w_Array) {
// var_dump(kirby()->site()->cdn());
// var_dump(kirby()->site()->toggle());
return $this->srcset($w_Array);
}
]
]);