Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by da²

  1. I don't how to do this, but by exploring HTML source of the repeater items in admin page (browser dev tools), looking InputfieldWrapper API and InputfieldRepeater API, and var_dumping things in a hook, I found a way. self::addHookAfter("Inputfield(name=championshipRoundRepeater)::processInput", function (HookEvent $event) { /** @var InputfieldRepeater $inputfieldRepeater */ $inputfieldRepeater = $event->object; /** @var InputfieldWrapper $wrapper */ foreach ($inputfieldRepeater->getWrappers() as $repeaterItemId => $wrapper) { /** @var Inputfield $itemField */ $itemField = $wrapper->getByName("title_repeater$repeaterItemId"); $itemField->error('this is an error'); } });
  2. Yes the site is terrible and full of bugs, I even had page freezes, not sure they really want their CMS to be used. 😄
  3. I reported this behavior to the dev who created the Twig module for PW and the given solution is to use get(). I hate some of the Twig behaviors and consider switching to another solution in the future. Another thing to know is that, when you call page.noIndex, if not found Twig will also call method page.getNoIndex(), property page.getNoIndex and a bunch of other calls like that...
  4. There's also bugs in Twig, sometimes it will say the variable doesn't exist when it exists but has no value. The workaround is to use get(): page.get('noindex');
  5. Looks like it's a feature since a few years.
  6. @fruid Use custom page classes. In site/classes: <?php namespace ProcessWire; class UserPage extends User { public function getMessages(): PageArray { return wire()->pages->find('template=message, receiver=' . $this->id); } } Be sure to enable it in site/config.php: $config->usePageClasses = true;
  7. Just to add another solution to the original question, this is how I hide not editable pages in admin tree: $this->addHookAfter('Page::listable', isPageListable(...)); function isPageListable(HookEvent $event): void { if ($event->page->path == "/") $event->return = true; else $event->return = wire()->user->hasPermission("page-edit", $event->page); }
  8. Why using JS and not a saveReady hook? And maybe a hook on ProcessPageEdit::processInput(form:InputFieldWrapper) to check that fields content is valid and mark them as "error" in the form. You can also manage errors in saveReady by displaying an error Notice to user.
  9. Maybe you have "use" statements replacing the missing namespace? Or maybe there's something different in composer.json configuration?
  10. And maybe Ryan is transpiling this CSS from SCSS, this is how I use UIKit.
  11. I was just joking about how you wrote the "Hit CMD+Enter" like if the answer is sure, don't take my message too seriously. 🙂 I wouldn't event trust the answer about rw-r--r--, because very often ChatGPT is absurdly wrong and answers the exact opposite of the truth. Then I correct it and next answer is good. So if I need to check the AI answers on the web, it's faster not to ask the AI and directly go on the web/documentation. Most of the time I use AI when I can't find answer with traditional ways. This part is more interesting IMO, discussing about architecture of your own code, things you can refactor, design patterns you can use... It can be a way to improve faster as a developer. I'm also working alone, and have worked in the past in a team that used to do regular code reviews.
  12. You have a lot of confidence in AI. 😄 I would replace with: check that the AI gave the correct command (using web or manual), then press Enter. ^^
  13. Hello, maybe a missing "namespace Processwire;" ?
  14. @Roadwolf I had a look in InputfieldCKEditor.module source code, and found this is related with HTML purifier. You can disable this feature in your field configuration > Field tab > Use HTML purifier, but that may not be recommended in some cases (read the option description). I don't have time to investigate more but this is related to HTMLPurifier class and probably one of the classes it uses to purify HTML. So maybe you can use this information to investigate or report an issue.
  15. OK I see, so to resume: you create a link in a CKEditor, put "irc://foobar" as link and after saving the page the link is removed, probably because CKEditor only allows http links. I don't know how to solve this yet, but now that the question is clear, someone else may help. 🙂 You should edit this topic title to something like: "How to add irc:// link in CKEditor?".
  16. @Roadwolf By "where" I mean: in which field? And what is the formatter used by this field? And could you show the text you enter and the text you get after saving the page?
  17. Hello @Paschalis, $featuredProperties = $pages->find("parent_id=1016, featured_properties=1"); Note that it will return only direct children of the page 1016, if you want also grand-children it's: $featuredProperties = $pages->find("has_parent=1016, featured_properties=1");
  18. @protro I see, this is a particular case so you don't need most of the features of a video platform. Yes you can do that.
  19. Hello @protro , Why not using a video platform (YouTube, Vimeo...)? Serving videos has many constraints that are already solved by this platforms (disk space, bandwidth to serve a large number of simultaneous streams, encoding to several streams with different bitrates, choice of the best stream based on client downloading speed...). To facilitate things for your customer you can put the upload form on his web site and transfer the video in the background to the video platform using its proprietary API. Then integrate the platform embedding code to display video player.
  20. Hello, you can bootstrap PW: include __DIR__ . "/path/to/index.php"; echo $user->isLoggedin();
  21. On Linux, enabling rewrite mode is usually as easy as writing: sudo a2enmod rewrite sudo systemctl restart apache2 Last command may depend on your distribution. More info: https://stackoverflow.com/a/5758551 ("a2enmod" means "Apache 2 Enable Module") You also need to set the "AllowOverride all" directive for this site (or in apache2.conf if there's no dedicated config for this site), if not set yet.
  22. Hello, To explain (if I'm right): It looks like you are using a custom page HomePage that is correctly instantiated (so we are sure it extends ProcessWire Page class). But the parameter of type Page in the function "visit(Page $parent)" is not of the correct type for PHP, so it seems that it doesn't recognize the specified Page type. I bet this is because you didn't include any "namespace" or "use" instruction in your file. Try to add this: <?php namespace Processwire; If you are new to PHP you can try PHPStorm IDE for a month, it's a great help for setting up a project with composer and learning PHP. But this is hiding the problem, not solving it. 🙂
  23. Is debug allowed in config.php? (to see errors) Is MySQL user configured with right permissions in this database? (user specified in config.php)
  24. Hi, Do you see something special in browser debugging tools, in network tab and JS console? Did you copy the site/config.php, to use the same salts? $config->userAuthSalt = 'xxx'; $config->tableSalt = 'yyy';
  25. One important thing to add: when exporting your pages, don't forget to disable output formatting before to read properties on pages: $myPage->of(false); So you're reading data as it was entered in database, without applying formatter defined in admin on this field. And when importing data, an easy optimization is to use database transaction: try { wire()->database->beginTransaction(); // Import data (creating and updating pages) wire()->database->commit(); } catch (Exception|WireException $e) { wire()->database->rollBack(); } For 100 pages, you won't really need optimization.
  • Create New...