Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by simonsays

  1. It was just a quick question to confirm, whether repeater field downgrade works out of the box or requires additional extending. Thanks for the reply.
  2. @LostKobrakai I have this code for repeater migration, however, I noticed something. Not sure if it is a bug or the way it should be. <?php class Migration_2018_11_18_00_00_00_RepeaterAccordionField extends FieldMigration { public static $description = "Add repeater for accordion"; protected function getFieldName() { return 'repeater_accordion'; } protected function getFieldType() { return 'FieldtypeRepeater'; } protected function fieldSetup(Field $f) { $f->label = 'Repeater accordion'; $f->collapsed = Inputfield::collapsedNever; $repeaterFieldGroup = new Fieldgroup(); $repeaterFieldGroup->name = 'repeater_' . $this->getFieldName(); //Add fields to fieldgroup - add others as necessary $repeaterFieldGroup->append($this->fields->get('title')); $repeaterFieldGroup->append($this->fields->get('content_columns')); $repeaterFieldGroup->save(); $repeaterTemplate = new Template(); $repeaterTemplate->name = 'repeater_' . $this->getFieldName(); $repeaterTemplate->flags = 8; $repeaterTemplate->noChildren = 1; $repeaterTemplate->noParents = 1; $repeaterTemplate->noGlobal = 1; $repeaterTemplate->slashUrls = 1; $repeaterTemplate->fieldgroup = $repeaterFieldGroup; $repeaterTemplate->save(); $repeaterPage = "for-field-{$f->id}"; $f->parent_id = $this->pages->get("name=$repeaterPage")->id; $f->template_id = $repeaterTemplate->id; $f->repeaterReadyItems = 3; //Add fields to the repeater - add others as necessary $f->repeaterFields = $this->fields->get('title'); $f->repeaterFields = $this->fields->get('content_columns'); $f->save(); } } If I rollback the migration, it deletes the field. But does not affect the fieldgroup. So, when I try to run the migration for the second time - it throws me an integrity violation error (originates from fieldgroups table). Is this the expected behaviour?
  3. No, I am using master (which is 3.0.98). Does it work there?
  4. Hello, Do you know, if there are any module alternatives or planned fixes for existing export and import functionality? I do understand that it is still in development phase and for the most part it works well. The only problem is that attached files (e.g. images) are not imported/exported together with pages.
  5. Bump. Any update on this? No feedback here, none on github ?
  6. I am still unsure why this fatal error was not displayed when using pure PHP (outside of module scope).
  7. @flydev Thank you very much for your help! Solved the issue. Would have struggled if it had not been for your help.
  8. Looks like this could be the thing. Thank you very much! Will get back shortly.
  9. That's the main issue, unable to reproduce it on my local computer ? My local XAMPP is 7.2.8 and server runs on 7.0.27 However, I did not believe that the php version could be the issue.
  10. I tried both ways and there is no real difference. I tried both } catch (SoapFault $e) { print 111;exit; return $this->client = false; } } catch (\SoapFault $e) { print 111;exit; return $this->client = false; } It reaches the "111" part but even with exit; the error is still thrown
  11. Also, forgot to mention, that the service works perfectly when SOAP service URL is correct and up. I just want to handle situations when it is not available for one reason or another.
  12. Hello, I am facing a mysterious issue. I have a module for connecting to external SOAP service (which is initialized along with the project). Since SOAP service times out every now and then, it is crucial to handle this timeout and hide error from the user. I have this bit of code in the module public function init() { ini_set('default_socket_timeout', 5); $configData = $this->wire('modules')->getModuleConfigData($this); if (!isset($configData['url_wsdl']) || empty($configData['url_wsdl'])) { return false; } $url = $configData['url_wsdl']; try { $this->client = new SoapClient($url); } catch (SoapFault $e) { return $this->client = false; } $this->session_id = $this->wire('input')->cookie('SSID'); } It works well in my local XAMPP environment and does not show any error or exception when connection fails. However, on the server I keep getting ugly error displays at the bottom of the page (red when loggen in and generic "internal" when I am logged out from admin). At first I thought, that this had something to do with php error settings on the server, but afterwards I tried this bit code to see if it works outside of PW and it did! No error was thrown despite forcing PHP errors. <?php error_reporting(E_ALL); ini_set('display_errors', 1); ini_set('default_socket_timeout', 5); try { $client = new SoapClient('faulty url goes here'); } catch (SoapFault $e) { echo 'wrong'; } var_dump($client); So, I assumed that processwire has to do something with that. What exactly is the issue and how can I disable displaying these errors? try ... catch block is not enough and I already tried force setting $config->debug to 'false'
  13. Logged issue on github https://github.com/processwire/processwire-issues/issues/736
  14. @ryan Found a bug which involves a certain scenario. My version is 3.0.98, therefore I am not sure if it has been fixed in later versions or should I raise an issue. Steps to reproduce: 1. Do a clean install of Processwire 3.0.98. 2. Install PageFrontEdit module. 3. Add repeater field and add an image field inside of it. Assign it to any template (I picked "home") 4. Create a page and add a button to open an edit modal dialog echo '<edit field="' . $page->fields->implode(',', 'name') . '" page="' . $page->id . '">'; echo '<a>edit</a>'; echo '</edit>'; 5. Open modal dialog on the front-end and upload an image to repeater. Save changes. 6. Open the dialog again and crop the image. Click "Apply" and "Save and replace". Expected behaviour: The form and the image field are updated with the new cropped image preview. Actual behaviour: Nothing is updated and old image preview stays. Through web developer tools and "network" tab I got a json error {"error":true,"message":"Field 'headline' is not applicable to this page"} The bug does not happen when editing the same page in admin as well as for "image" fields which are not inside a repeater. Has this been raised or fixed already? Or is this something you are unaware of?
  15. Thank you very much, I'll try (been on a holiday myself). I'd rather use your module instead, though...
  16. @adrian Hey man! Did you get a chance to reproduce the issue?
  17. Take your time, man. You are not paid for this ? I was just looking for a temporary solution while you fix your module.
  18. Hello, Moved this topic from "Modules". Put that there by mistake. to avoid caching I am trying to end up with a hook to append page->modified timestamp to all image urls. NB! I am aware of noCacheUrl method, but this one's no good as I want them to be out of cache on page update only. NBB! I have tried CustomUploadNames module but it breaks the image path when cropping images inside the repeaters. NBBB! Ideally it would be image->modified timestamp, which is unfortunately not updated on crop or focus. I have come up with something like wire()->addHookAfter('Pageimage::url', function($event) { $page = $event->object->get('page'); $p = ($page instanceof RepeaterPage) ? $page->getForPage() : $page; $event->return = $event->return . '?nc=' . $p->modified; }); This one has several issues though... 1) I end up with multiple appends, eg. ?nc=321223242?nc=4232424342323, etc 2) Page modified date is not updated when cropping an image (unless saving it afterwards, which is an overkill imho). Can anyone think of a better solution for that?
  19. @adrian I have come across a similar issue. My filename pattern is {$page->name}-{$file->filesize}-[YmdHis]. Rename on save is checked. The plan was to avoid caching, both on server side and on the client side, as our prod servers have several layers of cache. I tested with image field inside a repeater and crop functionality. Initially the image is uploaded fine and replacing image also works. However, when I crop it and save the page, the image still gets the old path (which is now broken), both in admin and on the front-end. I looked into both the DB and the filesystem. DB record (field value) is not updated and stays the same on crop. However, image filename is updated. Once again - this happens on crop, inside a repeater field. I tested without a repeater and indeed, it works fine.
  20. @adrian Yes, I am doing it via API, but I found a workaround.
  21. Hello, I am using two VPSs for a website and would like to have persistent admin login for both. E.g. when someone logs into admin on one server, he's automatically logged in on the second one. Both webservers are under the same domain (there is Varnish LoadBalancer on top, so it either fetches one version or another one). Is it possible to sync sessions in processwire? I have installed SessionHandlerDB module, but it does not seem to create any cookie (only session) on admin login. Is there a good module for that? Or should I add a login hook instead?
  22. This plugin is not so good as it sets embed properties globally (for our project they vary from page to page). I managed to get ACF working by slighly modifying your input to div(*)[*]{*} iframe(*)[*]{*} Guess, still own you a small one. This solves 2) with ACF. Still confused about 1) (HTML purifier).
  • Create New...