Search the Community
Showing results for tags 'dependency'.
-
Hello I've just hit a scenario where I have a particular field (within a repeater) that I'd like to set up a field dependency for, so that it shows only if an option from a page reference field (that sits outside of the repeater) is selected. Simply using the fieldname=value approach doesn't seem to work. I'm assuming that this is because the field in question is inside a repeater and can't access information from the fields that sit outside of it? I tried using the following without luck. To be honest I was just guessing at this point. page.fieldname=value forpage.fieldname=value There's other ways that I can set up my template, but I was just curious if there was missing a trick somewhere?
- 8 replies
-
- dependencies
- dependency
-
(and 2 more)
Tagged with:
-
I have a manufacturers page select field and a dependent models one with pages of template `model` which are allowed children of pages with template `manufacturer`. So I have this as the findPagesCode for the models page options field: return $page->manufacturer->children(); However this requires the page be saved in order to display options. This is not ideal. I have a singular autoload module with the following: public function init() { $this->pages->addHookAfter('render', $this, 'filterModels'); } public function filterModels($event) { $page = $event->arguments('page'); if($page->template != 'boat_vessel') return; $this->message("models filter"); } It's doing nothing. I was thinking I could work out something with this example but I would need the above test to be working first anyway... $this->pages->addHookAfter('changed', function(HookEvent $event) { $page = $event->object; $change = $event->arguments(0); if($page->template == 'boat_vessel' && $change == 'manufacturer') { // execute some code } }); But what? How do I refresh the models field? Is there a way to do this in the field settings? I would think in the custom PHP textarea that `return $page->manufacturer->children();` would work but it doesn't.
-
Hi there! And thanks for Processwire which i really like! Got a specific repeater-related question which i couldn't resolve. Will appreciate any help. Let's imagine we have Places (pages), Offers (pages) and Partners (PW users). Any Place can have many Offers attached to it via a repeater field. Any Partner can have many Places (repeater or a multiple-value field). He can offer some Offers at each Place he is attached to. His Offers for any Place should be selectable only from Offers already attached to this Place. Partner-Places-Offers management should be performed in admin interface via PW input fields. The ideal solution which i imagined could be a "dynamic" partner_place_offers repeater where multiple Offers for a single Place could be selected from dynamically built list dependent on selected Place. But it appears that PW doesn't have such functionality yet. Thanks in advance for giving some idea on the subject!
-
Hello, I am having an autoloaded module that should execute before another autoloaded module. Currently, my module is loaded after the other one -.- How can I achieve this? If that's not possible: How can I say that my autoloaded module should boot as first one in PW boot process? Thanks for your answers!
-
Is there a way to abort the installation of a module using the API if a certain condition is not met? I am trying to incorporate the module SchedulePages in my module Blog. Instructions would be for the user to first install SchedulePages. But users being users.... ....In case they attempt to first install Blog, I would like to halt the process if SchedulePages is not found. The reason is Blog will need to grab the two date fields created by SchedulePages and add them to the template 'blog-post'. I tried adding some logic in ___install() and init() but got no joy. Blog module was installed anyway. Should I be hooking into something? What is the process flow when modules are installed? What is called first? This situation I describe also arises because currently, AFAIK, PW will not download and install a third party module from the modules directory just because another module requires it. In my case, just because Blog says it requires 'SchedulePages does not mean PW will install it automatically if it is not bundled with Blog . Such third party modules need to be bundled with the module trying to install them. I suppose that is still the case. I tried Thanks.
-
Hi, If you have a module that depends on another module, is there a way to make sure that one gets loaded before the other?