Great!, this works very similar to my
Solution discussed here Add Explicit Support for Multi-Section Pages. With the difference that this is notably more ordered and its integration with “kirby patterns” is great.
However, I think that the use of Controllers and Models are essentials for the Modules, It would be great if you add the support for that.
Thank you for the feedback.
What would be your use-case for controllers and models? Since the modules are constrained to be displayed on one page only, I can’t think of one for models. Controllers might be useful though.
Modules Plugin v1.1.0
I just published a new version of the Modules plugin featuring some
new helper methods.
Split this topic
January 11, 2018, 6:42pm
Modules Plugin v1.2.0
The Modules plugin now has its own
Kirby extension registry for modules, which allows you to register modules from other plugins. Thanks to @dweidner for the idea.
November 3, 2016, 11:13am
i have a problem… again
i defined a image field in a module like:
label: Background image
and try to get the URL to the image in my module html.php with:
<?= $module->bgimage()->url() ?>
but i just get something like:
is the root of my page and http://localhost/localtest/kirbymodule/ fullscreen-bg5.jpg is the image for the module. But the url is not correct for the image.
have i overlooked something?
November 3, 2016, 11:16am
<?= $module->bgimage()->toFile()->url() ?>
November 3, 2016, 11:21am
Fatal error: Call to a member function url() on a non-object in…
BUT <?= $module->bgimage()->toFile() ?> gives me the a tag and i see the image:
<img src="http://localhost/localtest/kirbymodule/content/2-projects/1-project-a/3-static-wall/fullscreen-bg5.jpg" alt="">
hmm…anyway. i need just the URL for CSS-trickery.
November 3, 2016, 11:27am
Ok, then two options:
$image = $module->bgimage()->toFile();
$image = $module->image($module->bgimage());
November 3, 2016, 11:38am
both gives me :
Fatal error: Call to a member function url() on a non-object
This one looks weird but gives me the correct URL:
$image = $module->url()."/".$module->bgimage();
strange. have to use this i think. thank you for the input!
November 3, 2016, 11:44am
That’s weird, there should be another solution.
That’s very strange. Actually Sonja’s example should work,
$module is a simple page object. Which Kirby version are you using?
Thanks, I will do some testing in the next few days.
I have tested with your setup and can’t reproduce the issue. The “non-object” error generally occurs if the image does not actually exist. Have you verified that your
module has an image with that file name (attention: not your displayed page, but your module page)?
Just to let you know that there is a bug when updating programmatically a structure field in Kirby if the modules plugin and at least one module is present.
I have opened an issue with more details and code example on your Github repository
Modules Plugin v1.3.0
May I present: A brand-new release of the Modules plugin.
download the plugin here. Please let me know if there are any issues.
Split this topic
January 11, 2018, 6:45pm
10 posts were split to a new topic:
Modules plugin: Structure fields