Jump to content

---

Members
  • Posts

    23
  • Joined

  • Last visited

---'s Achievements

Jr. Member

Jr. Member (3/6)

2

Reputation

  1. I've got this code to fetch all pages: /** @var PageArray $pages */ $pages = $this ->wire('pages') ->find(sprintf( 'has_parent!=2,id!=2|7,status<%s', Page::statusTrash )); With this I fetch all pages except admin, but that includes the 404 page as well. Is there a way to exclude pages like the 404 page from the result? Or maybe loop through the result set to check for the pages response code (without curl that is)? I want to avoid filtering the 404 page by ID if possible.
  2. By any chance, do you know how to set a width on the table columns?
  3. Ah ,that's quite simple actually. It's working now, thanks!
  4. I'm using this piece of code to add a table layout to my module configuration: $this ->wire('modules') ->get('MarkupAdminDataTable') Then I use this to add rows to my table: $this ->wire('modules') ->get('MarkupAdminDataTable') ->row($data) But when I try to add a field to my table, It's not rendered as a field, I only see the the classname of the input field instead of the field itself. Is it possible to render a field into a table row?
  5. In my module's getModuleConfigInputfields method, I've added a field of type: InputfieldButton. I want this button have a different action than the usual submit button (which is still there) and the submit button to behave as it always does. For example; I want the InputfieldButton button to clear a few folders when it's clicked. Is this possible, if so, how can I achieve this?
  6. I use it in a before hook method page::render with prio 1.
  7. Sorry, forgot to mention; I want to do this inside a module method. When I do `$this->page->rootParent->id`, it will give me the following error: <b>Notice</b>: Trying to get property of non-object in So I've tried $this->wire('page') instead, but that method returns null.
  8. How can I check if the user is in the admin enviroment of processwire? At the moment I'm using some buggy url check but I figure that there must be something in processwire itself to check for that. I don't want to check if the user has administrator privileges, just if the user is visiting an admin url. Because the admin url can be changed from the admin panel I don't want to check on something hard coded as well. What is the best way to check for an admin page?
  9. So I discovered in this topic ( ) that I can cancel all hooks after my own hook. Now I want something like that. I want my hook which is called on page render to cancel all other events, also the after page render and the before page render methods, is this possible? This only need to be done when some conditions are met. /** method replaces original page::render method and is called with hook priority one */ method onPageRender (HookEvent $event) { if (my condition is true) { $this->cancelHooks = true; // to cancel all hooks to page::render // how to cancel after Page::render events // how to cancel before Page::render events } } Is this possible at all?
  10. I've written a hook which replaces the page::render method. Based on a few conditions, I might want to output something different from what page::render would return. So when my conditions aren't met, I want to use the return value of the original page::render method. How can I do this? At the moment I've got something like this: function pageRenderHookMethod (HookEvent $event) { if ('my condition' == true) { $event->replace = true; $event->return = 'my custom return value'; } else { $event->return = 'original return value of page::render'; } } But I don't know how to get the original return value of page::render because the would trigger my hooked method instead of the original method.
  11. I have created a hook with priority one because I want it to run asap. Now I want this same hook to prevent all other hooks from running, is this possible, if so, how can I achieve that? For example, normally hooks would run like this: hook 1 -> hook 2 -> hook 3 -> hook 4 -> etc. Now I want it like this: hook 1 -> hook 2 -> hook 3 -> hook 4 -> etc.
  12. Well it's in my first post: What I want, is that my menu, footer etc. are still visible but only the content of that page is replaced. I want to have a hook method in which I alter the content of the body based on a few conditions, but I don't want to replace the full HTML, only the content of the page, so that my menu, footer etc are still visible.
  13. I still think it's more ugly than using a hook because if you get more of these exceptions to add to this file it becomes fat and less readable about what it does. I found out that I just need to get a hook on \ProcessWire\TemplateFile::setFilename, but unfortunately that isn't a hookable method:/
  14. That looks like an uggly hack since that could be any page? Wouldn't it be way better to perform such logic in a module instead of a template file?
  15. Okay, and then? Because so far I only managed to get the full html page while I just want to reaplce $page->body (as an example). Yes, I know that, but that is in a template file. I want to alter it without using a template file as it should only be altered under specified conditions.
×
×
  • Create New...