Jump to content

verdeandrea

Members
  • Posts

    129
  • Joined

  • Last visited

Recent Profile Visitors

3,777 profile views

verdeandrea's Achievements

Sr. Member

Sr. Member (5/6)

17

Reputation

1

Community Answers

  1. @bernhard Yes, I tested the hooks, but they have some issues. The main “problem” with that workflow—specifically, having a field to “enable” statuses on the parent (courses) template—is that if the user is creating a new course and needs a new status, they would have to: Save the course. Go back to the parent page to enable the status and save it. Return to the course page, select the newly enabled status, and save the course again. This essentially turns the process into a 2-3 step task, whereas I’m aiming for everything to be achievable within the single course creation step. At that point, it’s actually easier to create the new status page directly from the course page. Then, if it’s not automatically selected (because it already exists), the user can simply select it and save the course again in a second step. This would still be quicker overall compared to the alternative workflow. I know it might seem like a small detail, but I believe this adjustment could improve the user experience and make the workflow smoother.
  2. Hey @da² this is the issue: When the user creates a new status, but a status page with that title already exists, the new status does not get selected in the field automatically. The user has to select it manually a second time for it to be applied. I think @bernhard’s proposed solution might fix the issue. I’ll give it a try and let you know how it goes.
  3. Hi @ottogal, thank you for your response! The challenge is that “Courses,” “Masters,” and “Workshops” are just examples. I have no way of knowing in advance what my client will create, so I can’t rely on static “Status” groups. Were you suggesting dynamically creating a new status group every time a new “Courses” page is added? If so, I’ve experimented with something along those lines. The issue I encountered is that the PageReference field requires a defined parent to allow the creation of new pages. Unfortunately, I haven’t found a way to make this work dynamically. If you have ideas or workarounds for this, I’d be happy to explore them.
  4. Hey @bernhard, thank you for your response! The issue is not necessarily that the list could grow large over time (although that wouldn’t be ideal from a UI perspective). The real problem is that I need to display filters on the frontend, even if no courses currently have that status. However, I only want to show the filters relevant to a specific group of pages. Here’s an example to make it clearer: The user creates a new “Course 1” and sets its status to “Open.” Later, the status of “Course 1” is changed to “Closed.” On the website, I need to display both filters, “Open” and “Closed,” even if no pages are currently assigned the “Open” status. The challenge is figuring out which filters to show if there’s no explicit action by the user to associate a specific filter with the group of pages. Without that, there’s no way to determine that I should display “Open” but not, for example, “In Preparation.” I considered adding a field to the parent page (e.g., “Courses”) to manually manage the available statuses for that group, but I’m trying to keep the backend workflow as simple as possible for my client. That said, I’ll give your suggestion with the hook a try and will get back to you. Thank you very much for the idea!
  5. Hi @bernhard, I’m not sure if I fully understood your question, but I’ll try to explain the situation in more detail, hoping to clarify things. My client wants to have a section called “Academy,” where they can create an unlimited number of pages (e.g., “Courses,” “Masters,” and “Workshops”). These are just examples, but there could be more, each with different names. Each of these pages has subpages (the ones I referred to as “Course 1,” “Master 1,” etc.). These subpages can also be unlimited in number, but they all share the same template. The client wants to allow filtering of these pages (on the frontend) based on a property called “status.” However, the possible status values are not predefined, and they can vary for each group of pages. Additionally, the client wants to be free to add or remove statuses for each group of pages as needed. For instance: Pages under “Courses” might have statuses like “Open” and “Closed.” Pages under “Masters” could have statuses like “In Preparation” or “Registrations Open.” On the website’s “Courses” page, users should be able to select a filter by status, e.g., see only pages with the “Open” status or vice versa. Similarly, on the “Masters” page, users would see filters like “Registrations Open” or “In Preparation” and use those to filter all the master pages. I hope this gives you a clearer idea of what I’m trying to achieve, but feel free to ask if you need more information.
  6. I’m working on a website with the following structure: |-- Academy (template = academy) | |-- Courses (template = courses) | | |-- Course 1 (template = course) | | |-- Course 2 (template = course) | | |-- Course [...] (template = course) | |-- Masters (template = courses) | | |-- Master 1 (template = course) | | |-- Master 2 (template = course) | | |-- Master [...] (template = course) | |-- Workshops (template = courses) | | |-- Workshop 1 (template = course) | | |-- Workshop 2 (template = course) | | |-- Workshop [...] (template = course) |-- Course Status (template = course_status) | |-- Status A (template = status) | |-- Status B (template = status) | |-- Status [...] (template = status) The course template includes a PageReference field called course_status, which connects to the pages under the “Course Status” section. Editor users cannot directly access “Course Status” pages but can create new statuses via the PageReference field (using the “Allow new pages to be created from field” feature). Objective I need to filter the status options by course groups. For example: Courses under “Courses” should share the same statuses. Courses under “Masters” should have a different set of statuses. If a new status is created under “Course 1,” it should automatically appear for all “Courses” but not for “Masters” or “Workshops.” Current Solution I save a reference to the parent page (e.g., “Courses”) within the newly created status page. This allows me to filter status options based on the parent group. Here’s how I implemented it: $wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) { if ($event->object->hasField == 'course_status') { $page = $event->arguments('page'); $parent = $page->parent; $statusPages = $this->pages->get(1028)->children("related_courses={$parent->id}"); $event->return = $statusPages; } }); $wire->addHookAfter('InputfieldPage::processInputAddPages', function(HookEvent $event) { $field = $event->object; if ($field->hasField && $field->hasField->name === 'course_status') { $coursePage = $field->hasPage; if ($coursePage) { $parentPage = $coursePage->parent; if ($parentPage && $parentPage->template->name === 'courses') { $selectedStatusPage = $field->value; if ($selectedStatusPage && $selectedStatusPage->template->name === 'status') { $selectedStatusPage->of(false); if (!$selectedStatusPage->related_courses->has($parentPage)) { $selectedStatusPage->related_courses->add($parentPage); $selectedStatusPage->save(); } } } } } }); The Issue The setup works well except in this scenario: 1. I create a new status (e.g., “Open”) under “Course 1.” It appears for all “Courses” as expected but not for “Masters,” which is correct. 2. If I try to create a status called “Open” under “Master 1”: A new page is not created (presumably because the title “Open” already exists). The “Open” status becomes available but isn’t automatically selected. I have to manually select it and save again to finalize the selection. Questions How can I ensure that the existing status is automatically selected in this case? Is there a better, more efficient way to manage the entire status setup? I’m open to restructuring if it leads to a smarter solution. Thanks in advance for your help!
  7. Hi and thanks for your module! I am trying to install it, but I get this errors: InputfieldWrapper: Skipped field 'cookie_groups' because module 'InputfieldAsmselect' does not exist InputfieldWrapper: Skipped field 'content_banner_text' because module 'InputfieldCkeditor' does not exist InputfieldWrapper: Skipped field 'content_banner_details_text' because module 'InputfieldCkeditor' does not exist InputfieldWrapper: Skipped field 'content_banner_privacy_link' because module 'InputfieldUrl' does not exist InputfieldWrapper: Skipped field 'content_banner_imprint_link' because module 'InputfieldUrl' does not exist InputfieldWrapper: Skipped field 'ask_consent_message' because module 'InputfieldCkeditor' does not exist I am on PW version 3.0.123 Do you know what can be causing this issue? Thanks
  8. I have the same issue, but I also noticed another problem: Initially I had Italian as main language, but I switched to English as main one. Now the new pages created by PageReference are created with the name "untitled-xxxxxxxxxxxxx" (xxx = a series of number) and they have no Italian title so the page has an error cause it is missing the main title. Does anyone know if I am missing some steps or should I also look into processInputAddPages?
  9. Does anyone knows on which files could I have a look to understand what is happening?
  10. I am sorry, that was a typo. The error is 410. Yes the error is always shown, also to guest users, if ProCache is enabled.
  11. Hello, I am using ProCache v3.1.8 on ProcessWire 3.0.96. Everything worked fine in the past, but today I noticed that the css file serverd by procache gives a 410 error. The file is there, I checked. I deleted the cached files, I deleted the css file, I looked into the .htaccess file looking for some clues about this problem but nothing worked. The only way i can see my website correctly again is disabling ProCache. Has anyone any clue on what could be the cause of the problem or on what should I do to fix it? Thanks!
  12. Thanks @wbmnfktr and @dragan! I was looking into it and it is acually way more complex than a single color picker. It is challenging and I would like to give it a try but I think I would initially go with dragan suggestion. It sounds like a smart and fast solution! Thanks!
  13. Hello everybody! I am working on a project that should allow the user to generate a gradient from the admin panel. Something similar to the Photoshop gradient panel, or to this https://www.colorzilla.com/gradient-editor/ Is anyone aware of an existing module that is already doing that? The alternative is that I try to write my first (!) module! Do you have any advice or suggestion on how I should approach this? Thanks
  14. Hello everybody, I'm working on website that has some simple queries. I have the same version on my server and on my client server but the one on my client server is incredibly slow on make some simple queries of pw pages. I suspect that could depend on server or database settings but I'm not an expert in that field so i don't know exactly what to look for. Does anyone has some advices on what could affect that? What should I check? Thanks!
×
×
  • Create New...