Jump to content

Beetrootman

Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by Beetrootman

  1. Hi, I'm getting an error when trying to use this module: Erreur fatale: Uncaught Error: Class 'kornrunner\Blurhash\Blurhash' not found in site/modules/ImageBlurhash/ImageBlurhash.module.php:245 #0 site/modules/ImageBlurhash/ImageBlurhash.module.php(71): ImageBlurhash->createBlurhash('/customers/a/6/...') #1 wire/core/Wire.php (397): ImageBlurhash->hookSavePageField(Object(HookEvent)) #2 wire/core/WireHooks.php (927): Wire->_callMethod('hookSavePageFie...', Array) #3 wire/core/Wire.php (465): WireHooks->runHooks(Object(FieldtypeImage), 'savePageField', Array) #4 wire/core/PagesEditor.php (849): Wire->__call('savePageField', Array) #5 wire/core/Pages.php (ligne 245 de site/modules/ImageBlurhash/ImageBlurhash.module.php) Any ideas what's causing it?
  2. Hi, thanks for the clarification Robin S. I had come to the same solution that it was something to do with have two page that reference each other. The reason I wanted to do this was from and end-user point of view. If the admin makes a connection from one event to another, then the second event should also visually reflect this. If there are multiple editors working on a site it's important they can quickly know which two pages are linked. In the end I created two more fields. A hidden text field that stores the name of the page with the reference (on the referenced page) in the page saveready hook, and a RuntimeMarkup field that outputs the page title. The page reference field is set to be visible if the text field is empty and vice versa. The RuntimeMarkup mark field is there only to output the title and be non-editable: $config->addHookAfter("Pages::saveReady", function($event) { $page = $event->arguments('page'); if ($page->soireedouble) { $double = wire('pages')->get($page->soireedouble->id); $double->of(false); $double->soireedouble_ref2 = $page->name; $double->save('soireedouble_ref2'); } }); P.s, it would be useful if this limitation of the page reference field would be in the documentation somewhere ? Thanks for all the help!
  3. Hi, thanks for the replies everyone. So I've installed Tracey, and the error I am getting is: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in /htdocs/cms/wire/core/Wire.php on line 1144. This error occurs when using my hook, and also when attempting to do the same thing with ConnectPageFields. The field is being updated correctly, very strange... Note, if I remove the line that updates the field, but still save the field, I also get the same error: $config->addHookAfter("Pages::saveReady", function($event) { $page = $event->arguments('page'); if ($page->template->name === 'single-spectacle') { if ($page->soiree_double) { $double = wire('pages')->get($page->soiree_double->id); $double->of(false); $double->save('soiree_double'); } } }); Update: I have tried the same thing on another processwire installation and I get the same error. So it doesn't seem to be related to the particular processwire configuration of the site I had the problem with.
  4. Hi, thanks for the reply. I actually use event->arguments, I just forgot to add it to my code as I have a couple of other functions I pasted a redacted version here. But, I tried your code anyway, and it still doesn't work.
  5. Hello, I have a page reference field, with the value type single page or boolean. On Page 1, when the user selects a page (Page 2) in the field, and then saves Page 1, I want to check which page has been selected, and then save Page 1 into the corresponding page reference field on Page 2: Page 1 -> Selected Page 2 in page reference field Page 1 -> Save page, hook into saveready, check which page was selected Page 2 -> Save Page 1 to field via API Now, I can get this working in practice. The field is being correctly saved on the referenced page, however, the main page being saved (Page 1) does not reload after the save process, it just stays blank. I get no errors or warnings being logged either. Here is my code: $config->addHookAfter("Pages::saveReady", function($event) { $page = $event->arguments('page'); if ($page->template->name === 'single-spectacle') { if ($page->soiree_double) { $double = wire('pages')->get($page->soiree_double->id); $double->of(false); $double->soiree_double = $page->id; $double->save('soiree_double'); } } }); Has anybody had similar problems saving a page reference field? If I change the field being saved to something else then the page reloads like usual, so it seems the problem is related specifically to the page reference field. Thanks
  6. Hello, I am working on a website for a theatre with a calendar of performances. I have a page (all events) which can have children (single event). The children have a repeater field called dates, where numerous dates and other information (number of seats etc) for that event can be set. One event may have three or four different dates. In the admin page list, I want to sort the children of the events page by the date of the first repeater. Setting the children sort order on the template of the events page to the dates field does not work, probably because the repeater has more fields other than just the date. Is there a hook I can use to sort the page list? Can I use ProcessPageList::execute? I would need to specifically target that one particular page and its children. In the screenshots below you can see the page list I want to sort (under Spectacles), and the dates repeater for each of those events. I hope my explanation is clear, Thanks for any help.
  7. Hello, I've run into a case where I don't want a user to be able to edit a parent page, but do want them to be able to sort/move its children. I know that the page-sort permission depends upon the same role having page-edit permissions on the parent, but I wandered if there was a way around this? For now I hide the "Edit" button with CSS if the user is not a superuser, but this is not an ideal solution as they could still potentially edit that page via the correct url. Is there anything I could hook into if a certain user tried to load the edit page for that particular parent template? Something like this, but I don't know how to actually prevent the page loading: $config->addHookAfter('Page::loaded', function (HookEvent $event) { $page = $event->object; if ($page->template == 'projects' && $user->id !== 41) { // Do something to stop that page being edited } }); Thank you for any help
  8. Hello, Is anyone able to explain this behaviour? When I open a repeater item for the first time, it has a 1px outline left and bottom, however if I close and open it again the outline is gone. I've checked with the inspector but can't really understand what's causing this. I've added a video of the problem below. Running ProcessWire 3.0.98 and Uikit admin theme. Thanks, Beetrootman repeater.mov
×
×
  • Create New...