Jump to content

bernhard

Members
  • Posts

    6,264
  • Joined

  • Last visited

  • Days Won

    314

Everything posted by bernhard

  1. ddev import-db -f site/assets/backups/database/db.sql is a very helpful command that can import dumps without PW running ?
  2. This is the rm-defaults snippet which I always use and works for me: <?php $rm->setPagenameReplacements('de'); $rm->setModuleConfig('AdminThemeUikit', [ // use consistent inputfield clicks // see https://github.com/processwire/processwire/pull/169 'toggleBehavior' => 1, ]); $rm->setModuleConfig('ProcessPageList', [ 'useTrash' => true, // show trash in tree for non superusers ]); // install german language pack for the default language // this will install language support, download the ZIP and install it $rm->setLanguageTranslations('DE'); $rm->installModule('LanguageSupportFields'); $rm->installModule('LanguageSupportPageNames'); $rm->installModule('LanguageTabs'); $rm->setFieldData('title', ['type' => 'textLanguage']);
  3. I've just added a small PR that makes PW load config-local.php additionally to config.php if the file exists: https://github.com/processwire/processwire/pull/267
  4. Lol, indeed! ? If you enable trailing slashes you get redirected from non-slash to slash urls ? Thx for the quick help!
  5. I'm not using url segments very often. Now I do and I'm a little surprised that there is no setting to force a trailing slash?! Searching the forum has also not lead to a helpful solution. Does anybody have a good and easy solution for it? Does it even matter from a SEO perspective?
  6. I've had similar problems. That's why RockMigrations comes with this: $rockmigrations->deletePage($page) This is how it works, maybe it helps: https://github.com/baumrock/RockMigrations/blob/1089f625048c4c68e883e46d1d57d7153c155bf2/RockMigrations.module.php#L1316
  7. @adrian's tracydebugger also has an api explorer panel that you might be able to get inspiration from ?
  8. Hey @adrian this is the whole block: // Session if (in_array('session', $panelSections)) { $session_oc = 0; $session = $this->sectionHeader(array('Key', 'Value')); foreach ($this->wire('session') as $key => $value) { if ( $key == 'tracyDumpItemsAjax' || $key == 'tracyDumpsRecorderItems' || $key == 'tracyEventItems' || $key == 'tracyMailItems' || $key == 'tracyIncludedFiles' || $key == 'tracyPostData' || $key == 'tracyGetData' || $key == 'tracyWhitelistData' || $key == 'tracyLoginUrl' ) continue; $session_oc++; try { if (is_object($value)) $value = (string)$value; } catch (\Throwable $th) { try { $value = json_encode($value); } catch (\Throwable $th) { $value = $th->getMessage(); } } if (is_array($value)) $value = print_r($value, true); $session .= "<tr><td>" . $this->wire('sanitizer')->entities($key) . "</td><td><pre>" . $this->wire('sanitizer')->entities($value) . "</pre></td></tr>"; } $session .= $sectionEnd; } Not sure about this and when that code is used. But I think we can ignore this request. I've changed my code to save values as plain array in the session. The session is not meant to store any type of object, so it's ok if it breaks I guess?!
  9. Hey @ryan sounds like a great module ? Wouldn't it be nice if the module's config screen showed that information? So it would be in a safe space without additional steps to do ?
  10. Hey @eydun The module uses PHP8 syntax/features on several spots. All my modules do, as PHP7.4 is end of life and updating should be very easy. There will definitely be some challenges. Most likely a lot more than upgrading your site to PHP8.1 or 8.2 which would be the best thing to do anyhow ?
  11. Ok great, I thought I might be missing something, which can easily happen if you don't use the "regular" approach any more ? For me the runtime approach in general is a huge benefit. Once you start defining things in code all the little details that you would usually avoid because the GUI does not support it suddenly become a no-brainer and very easy to add. All the little customisations that you'd usually need a hook or a module for. They are simply there in your pageclass and you start to develop the backend (page editor) similar to how you'd develop your frontend. <?php public function editForm($form) { if ($f = $form->get('title')) { $f->appendMarkup(" <div>Custom field markup without any hooks...</div> <style>#wrap_Inputfield_title {border: 5px solid red;z-index:1;}</style> <script>console.log('js-demo');</script> "); } } PS: Note that this code will only be added on the page editor of pages having the pageclass where you defined your editForm() method! So if you added that in HomePage.php you'll only get the red border on the "home" page ?
  12. Hey @gebeer working with fieldsets in migrations has always been a bit of a pain for me. That's why I'm using them only at runtime in all of my projects. I don't see any drawback with this. Using MagicPages it is as simple as doing this: <?php ... public function editForm($form) { ... $rm->wrapFields( // current form wrapper $form, // fields inside the fieldset [ 'foo' => ['columnWidth'=>33], 'bar' => ['columnWidth'=>33], 'baz' => ['columnWidth'=>33], ], // fieldset settings [ 'label' => 'Your Runtime Fieldset', 'icon' => 'bolt', ] ); } This is a lot quicker than messing around with fields, field order, moving the ending field to the correct place etc. I only place the fields on the correct template, which is necessary for the fields to be queryable by selectors etc and all the rest is done in code in the pageclass. That also makes it possible to switch layouts based on the user's role for example. So the approach is very powerful. I don't see that as a limitation. Or are there any things that I'm missing?
  13. <?php public function editFormContent($form) { $form->add([ 'type' => 'text', 'name' => 'published', 'label' => 'Published at', 'value' => date("Y-m-d H:i:s", $this->published), ]); } public function onProcessInput($form, $input) { $pub = date("Y-m-d H:i:s", strtotime($input->published)); $query = $this->wire->database->prepare( "UPDATE pages SET published=:pub WHERE id=:id" ); $query->execute([':pub' => $pub, ':id' => $this->id]); } ?
  14. Using RockMigration's MagicPages feature: <?php public function editFormContent($form) { $form->add([ 'type' => 'markup', 'label' => 'Published at', 'value' => date("Y-m-d H:i:s", $this->published), ]); } No additional fields needed as @Jan Romero said ?
  15. As I've had the exact same issue yesterday (and also have been adding those rules to every single project) RockFrontend v2.34.0 adds those rules in the defaults.less file wich you simply have to add to your styles array: $rockfrontend->styles() ->add('/site/modules/RockFrontend/less/defaults.less') // add this line // uikit styles ->add('/site/templates/uikit-3.16.3/src/less/uikit.theme.less') ->add('/site/modules/RockFrontend/uikit/defaults.less') ... // minify on production ->minify(!$config->debug);
  16. @Stefanowitsch you can have a look at this old thread: https://processwire.com/talk/topic/13418-prevent-hover-click-on-multilevel-menu-on-touch-devices/ Maybe some similar approach could serve as a simple fix? Or is that something totally different?
  17. Yes, the blog is a PW website. I've had the honor to write one post there some time ago ? I agree that it would be nice to have it on github so that everybody can contribute. But we have lots of blog posts and converting all of them would be a lot of work I guess. But realistically I think nobody would ever contribute a lot except from maybe reporting typos... So I doubt it would make a huge difference if everything was hosted on github.
  18. Thx for reporting back @Stefanowitsch It sounds like this might be a feature (snippet) that we could add to rockfrontend? How does that fastclick work or what does it do? Not sure if I'd feel good using this script on one of my websites ?
  19. Exactly. I'm happy that you see and understand the potential and that you share that ? Definitely ? Thx for the comment! Having everything in one huge migrate.php does not only have the drawback of getting messy quickly. It does also mean that your migrations get slow, because whenever you change anything in that file all migrations will run, no matter if they are necessary or not. If you have everything in separate files on the other hand you get cleaner code, easier to understand chunks and RM will only trigger the migrations that have changes since the last page load, which makes page loads usually be ~1s here even when migrations run. Yep! ? If you understand the principle once, then you will instantly understand every project you are working on that follows the same simple principles.
  20. Had the same need today and using the latest dev version of RockMigrations + MagicPages you can do it like shown in the other post: https://processwire.com/talk/topic/23385-solved-how-to-remove-dropdown-items-from-submit-button/?do=findComment&comment=231535
  21. Had the same need today. When using the latest dev version of RockMigrations you can use MagicPages to achieve this: public function editForm($form) { $this->removeSaveButton($form); }
  22. Or maybe better update the docs so that they can reference blog posts. We have many important explanations in blog posts and the should be linked from/to the docs imho ?
  23. Yes, that's easy of course, but UIkit relies on the primary color in many places... there is .uk-background-primary, .uk-section-primary, .uk-button-primary etc etc. All those places would still show up with the less-defined primary color. I think porting all that to css variables would be a huge effort. But I'm happy if I'm wrong and you show me how it can be done easily ? https://github.com/uikit/uikit/issues/4534 --> my like has been there for quite a while ?
  24. Yeah I'm having these css variables in my head for a long time. Though I'm not sure if it would be wise to jump onto that train. UIkit is built in a very modular way, but it relies heavily on LESS all over. It's super flexible and easy to customize just by setting different variables: I don't think that we'd get this level of control with using css variables? The drawback of less variables is that you need to recompile everything on change whereas when using css variables you can apply changes on the fly via JS, which is cool. For working with dark and light mode there is also https://getuikit.com/docs/inverse. It's a huge topic ?
  25. Hey @adrian I'm getting an error when having a Nette ArrayHash in a session variable: Error: Object of class __PHP_Incomplete_Class could not be converted to string in /var/www/html/site/assets/cache/FileCompiler/site/modules/TracyDebugger/panels/RequestInfoPanel.php:813 Stack trace: #0 /var/www/html/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Bar/Bar.php(143): RequestInfoPanel->getPanel() #1 /var/www/html/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Bar/Bar.php(115): Tracy\Bar->renderPanels('') #2 /var/www/html/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Bar/Bar.php(89): Tracy\Bar->renderPartial('main') #3 /var/www/html/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Debugger/DevelopmentStrategy.php(123): Tracy\Bar->render(Object(Tracy\DeferredContent)) #4 /var/www/html/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Debugger/Debugger.php(309): Tracy\DevelopmentStrategy->renderBar() #5 [internal function]: Tracy\Debugger::shutdownHandler() #6 {main} This fixes it for me: try { if (is_object($value)) $value = (string)$value; } catch (\Throwable $th) { try { $value = json_encode($value); } catch (\Throwable $th) { $value = $th->getMessage(); } }
×
×
  • Create New...