Jump to content


  • Posts

  • Joined

  • Last visited

Recent Profile Visitors

2,564 profile views

Xonox's Achievements

Full Member

Full Member (4/6)




Community Answers

  1. Hi, @Zeka Thanks for your reply. Unfortunately the page cloning wasn't going through that page. It just cloned the existing page and displayed it in the tree. Apparently, there's some problem about the permissions. SOLUTION: Instead of giving Clone Permissions to just the templates you want to allow to clone, you should authorize page-clone for all editable templates and revoke all the templates except the ones you want to allow. This allowed the users to go through the clone page and select which options they want.
  2. Update: Clearly, the problem happens only with pages that have sub pages. Is there anyway I can clone a page, without cloning sub-pages?
  3. It looks that pages that have subpages can't be cloned?!?! Is there anyway that I can circumvent this? I would like to clone a page without the subpages.
  4. After some years with a website working perfectly, Page Clone started to display some strange behaviour: 1. When cloning some pages, it takes forever. The waiting icon is displayed but the page never appears. Only after I refresh the tree page, the new page appears: 2. The other thing is that some pages can't be copied. The pages have the same templates but the users are able to copy some and other don't. It gives this error: (the URL is .../page/clone/?id=76376&login=1) Does someone have a clue why this is happening. I can't find any real difference between the pages that I'm trying to copy. One more thing: If the user is a super user, he's able to copy every page without problems. I think both errors might be related. Thanks!
  5. Changing table to InnoDB solved it! Hi, that's what worked, for me, changing that one table (pages) into InnoDB. Because it was an issue that needed time, to see if it would happen again, I didn't update this issue. Hope this helps you!
  6. Update: If the field is outside a repeater, it works fine! In my dev server, everything works fine inside the repeater. In production server, the field inside the repeater doesn't work as it should. Inside repeater, I can't even edit image descriptions. Field outside the repeater works fine on both machines. I just remembered that I had this problem before, on another site, but never got solved: This is getting a bit annoying! 😞
  7. It looks related, but I still can't get it to work. There are some new inputs: 1. The field is inside a repeater; 2. Despite the field being set to have only one image, in some cases it has more than one that I can't delete; 3. Tried to change files' permissions but it still doesn't work; 4. It's impossible to delete the images, but when I load a new one, it replaces one of the old ones. I'm a bit lost with this one. 😞
  8. Update: I also can´t delete the slide_image_mobile images, which should be unique (only one image). It keeps adding images despite the field being set with only one image and "One element null if empty".
  9. I checked and it looks fine. To clarify: slide_image - is detected and used; slide_image_mobile - site behaves as it doesn't exist! Both have same permissions. I changed the code to the following to force the use of slide_image_mobile: foreach($page->home_slides as $slide) { $slide_image_mobile = $slide->slide_image_mobile->size(1048,800); ?> <img src="<?php echo $slide_image_mobile->url; ?>" class="img-fluid d-block d-md-none" title="<?php echo $slide->slide_title; ?>" alt="<?php echo $slide->slide_title; ?>" /> <?php } Which gives a Fatal Error (Call to a member function size() on null) which makes sense. But the image is there! 😞
  10. Hi, There's something happening in ProcessWire that doesn't compute abd it has to do with images. Situation: On the homepage template there's a repeater that takes two images to build a slider: slide_image: A wide image for desktops slide_image_mobile: A more "verticalized" image for small screens Now I have this code: foreach($page->home_slides as $slide) { // Create desktop slide if(isset($slide->slide_image)) { // Create desktop slide $slide_image = $slide->slide_image->size(1170,400); // Create mobile slide if(isset($slide->slide_image_mobile)) { $slide_image_mobile = $slide->slide_image_mobile->size(1048,800); } else { $slide_image_mobile = $slide->slide_image->size(1048,800); } ?> <div class="slide-content"> <a href="<?php echo $slide->link; ?>" class="slide"> <img src="<?php echo $slide_image->url; ?>" class="img-fluid d-none d-md-block" title="<?php echo $slide->slide_title; ?>" alt="<?php echo $slide->slide_title; ?>" /> <img src="<?php echo $slide_image_mobile->url; ?>" class="img-fluid d-block d-md-none" title="<?php echo $slide->slide_title; ?>" alt="<?php echo $slide->slide_title; ?>" /> </a> </div> <?php } } On my dev server, the small image is detected and placed in content, however in my production server this doesn't happen. I've double checked fields names and the fields contain images. I've even imported the database into the Dev Server. I don't have any clue why it works locally and not in server. Can anyone shed som light? Thank you!
  11. Bingo! In case someone needs it: // Activity form if($page->template == 'activity') { $forms->addHookBefore('FormBuilderProcessor::renderReady', function($e) { $form = $e->arguments(0); if($form->name == 'activity_form') { $page = wire('page'); // IS THIS RIGHT? $selected = array(); // IS THIS RIGHT? $selected['selected'] = 'selected'; // IS THIS RIGHT? // Get Atividade field $inputfield = $form->getChildByName('atividade'); // Get InputfieldPage $select_field = $inputfield->getInputField(); // Get the correspondent InputfieldSelect $select_field->addOption($page->id, $page->title, $selected); // Add current page as selected option } }); $activity_form = $forms->render('activity_form'); } Thanks for your help @elabx, it made all the difference!
  12. So close and yet so far! if($form->name == 'activity_form') { // Get Atividade field $inputfield = $form->getChildByName('atividade'); $page = wire('page'); $inputfield->addOption($page->id, $page->title, array('selected')); } Two problems: 1 - $page = wire('page'); is this the best way to have access to the page id and title inside the hook? Is there a performance issue? 2 - Error on addOption: Error: Exception: Method InputfieldPage::addOption does not exist or is not callable in this context (in E:\WebServer\clinicadasconchas.pt\wire\core\Wire.php line 519) #0 E:\WebServer\clinicadasconchas.pt\wire\core\Wire.php(386): ProcessWire\Wire->___callUnknown('addOption', Array) #1 E:\WebServer\clinicadasconchas.pt\wire\core\WireHooks.php(723): ProcessWire\Wire->_callMethod('___callUnknown', Array) #2 E:\WebServer\clinicadasconchas.pt\wire\core\Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\InputfieldPage), 'callUnknown', Array) #3 E:\WebServer\clinicadasconchas.pt\wire\core\Wire.php(445): ProcessWire\Wire->__call('callUnknown', Array) #4 E:\WebServer\clinicadasconchas.pt\site\assets\cache\FileCompiler\site\templates\_init.php(31): ProcessWire\Wire->__call('addOption', Array) #5 E:\WebServer\clinicadasconchas.pt\wire\core\WireHooks.php(813): ProcessWire\TemplateFile->{closure}(Object(ProcessWire\HookEvent)) #6 E:\WebServer\clinicadasconchas.pt\wire\core\Wire.php(442): ProcessWire\WireHooks->ru It looks like it is a InputfieldPage field, and this doesn't have addOption method.
  13. Thinking about this alternative. This might work better. So now I have a working code inside _init.php: // Activity form if($page->template == 'activity') { $forms->addHookBefore('FormBuilderProcessor::renderReady', function($e) { $form = $e->arguments(0); if($form->name == 'activity_form') { // Get Atividade field $inputfield = $form->getChildByName('atividade'); // I NEED TO INSERT A SELECTED OPTION HERE // something something = $page->id; } }); $activity_form = $forms->render('activity_form'); } Getting close. Can someone help?
  14. Hi @elabx, Thanks for your reply. I really need some help here, working with Hooks. First, watching the function you showed me, I believe that the responsible bit for not having the self page in the selector is the last part. So it's not a bug, but a feature (not sure why). This are the lines I need to override.: if($children && $children->has($page)) { $children->remove($page); // don't allow page being edited to be selected } I was playing around with the hooks but I couldn't figure it out. Form builder doesn't have a InputFieldPage Hook, so how am I supposed to hook into it? The code below must be completely wrong, my apologies, but I'm completely lost here (I have this inside _init.php): if($page->template == 'activity') { // This hook will make sure that the list of pages include self page $this->addHookBefore('InputfieldPage::getSelectablePages', function($event) { $children = $pages->get('parent=1066'); return $children; }); $activity_form = $forms->render('activity_form'); } Can someone point me to the right direction? Thanks! Alternative When rendering the select field, add current page and make it selected. Is this possible?
  15. Hi, I'm having a problem with a page selection field. I have the following tree set up: Activities - Activity 1 - Activity 2 - Activity 3 - Activity 4 So I created a form where you can select one of the activities on which you would like to participate. For usability purposes, the form is inserted in each Activity page, so that the user doesn't have to click to get to a form. I have two problems (let's say the user is inside the "Activity 2" page); 1. Inside the form, where the user can select the activity, the current page is not listed, so the user can select "Activity 1", "Activity 3" and "Activity 4", but not the one in which he is. This one might be a bug. 2. It would be nice that the activity in which he is - Activity 2 - Would be selected by default. Is there any way that I can accomplish this without a custom markup form? Thank you.
  • Create New...