Jump to content

PawelGIX

Members
  • Posts

    48
  • Joined

  • Last visited

  • Days Won

    1

PawelGIX last won the day on August 24 2012

PawelGIX had the most liked content!

Profile Information

  • Gender
    Male
  • Location
    Poland

Recent Profile Visitors

4,480 profile views

PawelGIX's Achievements

Jr. Member

Jr. Member (3/6)

26

Reputation

  1. It works but does not affect the number of children displayed. So there is a discrepancy between what you see in the tree and the number next to it.
  2. After adding to ready.php this code nothing was logged. $wire->addHookBefore('ProcessPageLister::getSelector', function(HookEvent $event) { // Get the object the event occurred on, if needed $ProcessPageLister = $event->object; bd($event, '$arguments'); });
  3. I'm looking for a solution that would allow me to hide some templates from the tree list in the admin and modify the Children number to the correct value. Is there such a hook? I would also like it to work for superuser. I tried couple of them like ProcessPageList::find or ProcessPageListRenderJSON::execute but without luck. Update: I managed to achieve what I wanted, but to do it I had to use two separate hooks. $wire->addHookAfter('ProcessPageListRender::getNumChildren', function (HookEvent $event) { $user = $event->wire()->user; $username = $user->name; if ($username !== FULL_PAGE_TREE_USERNAME) { $page = $event->arguments(0); $return = $event->return; $return = $page->numChildren('template!=category|board-category, include=all'); $event->return = $return; } }); $wire->addHookAfter('ProcessPageList::find', function (HookEvent $event) { // Get the user $user = $event->wire()->user; $username = $user->name; if ($username !== FULL_PAGE_TREE_USERNAME) { $event->return->each(function ($p) use ($event) { if ($p->template == 'material-group') $event->return->remove($p); if ($p->template == 'board-category') $event->return->remove($p); if ($p->template == 'category') $event->return->remove($p); return; }); } }); I hope it doesn't have any side effects. If there's a better method, I'd love to know about it 😉
  4. I have some custom fields and I wanted to add validation to them using hooks. Unfortunately, I cannot access the fields inside the images field. How to run custom validations on them and return an error when editing the page I want to add validation to aspect_ratio only when we have a given URL to the video I have this much for now but I don't know how to move on. <?php wire()->addHookAfter('ProcessPageEdit::processInput', null, 'checkAspectRatio'); function checkAspectRatio($event) { $form = $event->arguments(0); // ProcessPageEdit's processInput function may go recursive, so we want to skip // the instances where it does that by checking the second argument named "level" $level = $event->arguments(1); if($level > 0) return; if($form->get("additional_images")){ } }
  5. I am trying to get some sites to remain in Unpublished status until certain conditions are met. However, I have a problem with the message ProcessPageEdit: Published Page. Overall, wire()->addHookAfter("Pages :: saved") seems to work for existing pages. And I can put them into Unpublished status whenever I want after I have saved them. But when creating a new page, the order of events is different. The newly created page is set to Published status when someone clicks Publish in the second step of the page adding process. But it runs after my code. How to solve this problem? Is there any documentation about the order of events?
  6. How to programmatically clear the page cache? I have a page that uses URL Segments. Based on the value of the URL Segment, the content of the page varies. From what I can see, the cache can handle it without a problem. But I have another question. I need to create an API that will clean the cache of selected pages - based on the value of URL Segments or some other value. Is there an API that will allow me to manage the page cache generated by PW?
  7. I always have a problem with writing JSON data to wire ('cache') with this. It would be good if the documentation warned about such behavior. I think the cache should always return data in the format you sent it to.
  8. I have processwire You don't have access to the template required to add pages here (in /wire/modules/Process/ProcessPageAdd/ProcessPageAdd.module line 506) I have ProcessWire 3.0.148. So far it has worked fine, but recently (maybe after an update) I am getting this error. The error appears when you try to add a new subpage using the Superadmin account. I think the superadmin has access to all options? Does anyone have an idea how to fix this? UPDATE: It turned out that my settings in Family did not allow me to create a page from any template due to the configuration. The message misled me a bit;)
      • 1
      • Like
  9. Can I convert uploaded images to PNG, GIF, BMP -> JPEG? Is there any function in the API that I can change the file type?
  10. I get error: Recoverable Fatal Error: Object of class DirectoryIterator could not be converted to boolean (line 671 of /home/users/g2s/public_html/automotive2/wire/modules/LanguageSupport/ProcessLanguageTranslator.module) This error message was shown because: site is in debug mode. ($config->debug = true; => /site/config.php). Error has been logged. When i access page /processwire/setup/language-translator/add/?language_id=1017. Latest stable ProcessWire. What can i do? UPDATE ProcessLanguageTranslator.module Line 671: // if(!$dirIterator) return array(); if(!$dirIterator->valid()) return array();
  11. Yes but i want do this in one place. In hooks maybe. I want to do this for the whole site. Not changing every place with ->url()
  12. How can I override the url method to add an extra get parameter to each address? Ex: About page url /about/ like this /about/?param=2
  13. I found it. Missing file: admin.php in templates directory. By the way very helpful would be an error message in this case, or log entry
  14. Exactly. No PHP errors. No errors in PW logs. Server HTTP response 200. I have no idea what to do next
  15. Is enabled alredy
×
×
  • Create New...