Replies: 1 comment
-
I would suggest you to hook the class instance yourself to a property other than ---
title: Page Title
description: Page description.
author: '@foo'
authors: ['@foo', '@bar', 'Baz']
...
Lorem ipsum dolor sit amet. Then in an Hook::set('page.authors', function($authors) {
$authors = (array) $authors;
foreach ($authors as &$author) {
if (str_starts_with($author, '@')) {
$author = new User(LOT . DS . 'user' . DS . substr($author, 1) . '.page');
// or `new User(LOT . D . 'user' . D . substr($author, 1) . '.page')` in Mecha 3.x.x
}
}
unset($author);
return new Anemon($authors);
// or `new Anemone($authors)` in Mecha 3.x.x
}); Then in a <p>
<b>Authors:</b> <?= $page->authors->map(function($author) {
if (is_object($author)) {
return '<a href="' . ($author->link ?? $author->url) . '">' . $author . '</a>';
}
return $author;
}); ?>
</p>
No it isn’t. I can make an extension for that. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
On a web, sometimes it takes more than one author.
How can Mecha execute it with a PHP script in the layout directory properly, Mas Taufik? So that in the end it renders as we expected.
That's not enough. Mecha has
user
andpanel
extensions. Then a PHP script for multiple users should at least issue:Everything refers to and is synchronized with the data in the previously inputted from
user
extension. At least like this:Maybe entering "multiple users" in the GUI form in the extension
panel
is too cumbersome. But, matur nuwun, thanks for the discussion, Mas Taufik.Beta Was this translation helpful? Give feedback.
All reactions