Jump to content

bernhard

Members
  • Posts

    6,264
  • Joined

  • Last visited

  • Days Won

    313

Everything posted by bernhard

  1. It's this setting on the "input" tab of your page reference field:
  2. Yeah that's why I'm asking ? I'm always using LESS and I've built all the tools to easily compile LESS to CSS on the fly. That's not the case for SCSS. I've just pushed an update and updated the readme to support what you need: https://github.com/baumrock/Scss
  3. Just want to mention that ProcessWire has had great frontend editing capabilities for years: And for more complex content (like images) having a modal is not too bad in my opinion: But yeah, I agree that the frontend editing tools could get some love and could be improved. For example the modal could have more events to listen to. And maybe instead of reloading the whole page it would be nice to just replace the corresponding block instead of refreshing the whole page. On the other hand I'm not sure how much benefit that would really bring. A page reload is often helpful or even required (eg for loading different styles or scripts when something changed) and in my opinion it does not really hurt. Compare this to what you linked to: https://aaronmbushnell.com/images/live-reload.mp4 What you see here is a problem that is quite underestimated in my opinion. The barrier between frontend and backend might be easy to grasp for us developers that built the website, but it's not so easy for clients. Which field ends up where in the final design? How does the field "headline" look? It's just text in the backend! You have no visual idea of the final result. And having all fields in a sidebar does not solve these problems in my opinion. I can't even see the changes that he makes for the "accordion"! I see him changing field values, but I don't see where that content is changed on the site... With frontend editing you don't have these problems. Clients can just doubleclick on the text that they see and start typing ? Pssst: RockPageBuilder in action here ? Sign up for https://www.baumrock.com/rock-monthly/ if you want to get notified when I release it or write me a PM.
  4. Do you really want scss or would less also be OK?
  5. Sorry, that was too short ? Nope --> That was the answer to your question if your shortcuts make a difference. Just tried to paste it into the html field of jsfiddle.net and it pastes just the text without any markup --> that was something that I tried on my own after your suggestion to see what is actually stored in my clipboard. But that was nonsense, I think. I thought that jsfiddle might also show all the markup with all the tags when pasting, but it just shows text only. I'm not sure why this happens and what's going on and what is actually stored in the clipboard when copying text from websites, but I think a plain text field should be frontend editable without having to worry about encoded markup ending up in the field ?
  6. There's now a new tweak in RockMigrations to set all languages of newly created pages active by default:
  7. Nope. Just tried to paste it into the html field of jsfiddle.net and it pastes just the text without any markup ?‍♂️ I've created an issue: https://github.com/processwire/processwire-issues/issues/1818
  8. Yeah, feel free to grab it here and improve/maintain it for the future ? https://github.com/baumrock/rockhitcounter
  9. When using DDEV you can check if everything works with your specific installation just by changing a value in .ddev/config.yaml of your project. Here are all the possible database types that are supported: https://ddev.readthedocs.io/en/latest/users/extend/database-types/ Yes, you need to install DDEV first. But you'll never ever have these kind of problems or fears any more. Locally I'm on MariaDB 10.6.12 InnoDB on most projects and have no issues.
  10. I'm using frontend editing all the time. Suddenly on my new project when I tried to copy and paste several regular text-field contents: I ended up with markup in my fields: So I always need to hit the edit icon to edit it in the modal which shows the backend inputfield and there I can safely copy&paste like this: Any ideas why this would happen? I'm not sure why I didn't experience this behaviour so far. Maybe it's an update of something?
  11. Glad you got a working solution, but what you said is not 100% correct ? I used $page->template != 'something' and this will work. But it will only work if you use the "not equal" (!=) operator. It will NOT work, if you use the "not identical" (!==) operator! Check this out: So if you use the two letter comparison (== or !=) then PHP will try to convert your $page->template into a string and ProcessWire will be smart enough to use the template's name. So you'll end with a string == string comparison and you should get the desired result. If you use a three letter comparison (=== or !==) then PHP will not convert $page->template and object === string will always be FALSE and object !== string will always be TRUE. Hope that makes sense ?
  12. There seems to be a module that does what you need: https://processwire.com/modules/restrict-tab-view/ (at least for the tabs! I haven't used it though). But you can do both quite easily with two hooks in /site/ready.php - unfortunately you can't do everything in one hook because you need to hook "before" and "after" the buildForm(Content): <?php // hook to make the title field non-editable $wire->addHookAfter("ProcessPageEdit::buildFormContent", function ($event) { // get the page being edited $page = $event->process->getPage(); // check if the page has the desired template if ($page->template != 'your-template') return; // check if the user has the desired role if (!$this->wire->user->hasRole('admin')) return; // get the form that was built in buildFormContent() method $form = $event->return; // make the title field non-editable $f = $form->get('title'); $f->collapsed = Inputfield::collapsedNoLocked; }); // hook hide the settings tab $wire->addHookBefore("ProcessPageEdit::buildForm", function ($event) { // get the page being edited $page = $event->process->getPage(); // check if the page has the desired template if ($page->template != 'your-template') return; // check if the user has the desired role if (!$this->wire->user->hasRole('admin')) return; // set noSettings property dynamically $page->template->noSettings = 1; });
  13. Hi @olafgleba thx for sharing and congrats for the great result ?? Not sure if I understand that correctly, but wanted to add that you might not need an additional field here. Not saying an additional field is bad, though ? You could either access the user that created the page via $page->createdUser or, if you need a different logic you could use $page->meta('youruser', 'yourvalue') instead of adding a field to that page and then use that for storage. Have you thought of using url hooks or url segments to show your content with custom logic at a custom/different location than the original url? You might save you from the hassle of keeping everything in sync then.
  14. With RockPageBuilder this would look like this: You can easily create new blocks by clicking on the plus after the last block and every block consists of one PHP file for the business logic (if needed), one PHP/LATTE file for the output markup and optionally one .less file for the stylings: If you do it smart then you can even reuse these blocks in other projects just by copy and pasting these files ? Compared to RepeaterMatrix which would also be a possible solution RockPageBuilder comes with great integration and a complete UI for frontend editing: So instead of using $block->headline to output the headline of the block you simply use $block->headline() and your headline will be frontend editable!! For non-text fields you can double click anywhere and the editing interface will be loaded in a modal. ? I've not done a single website without that module for a very long time ? It will be 49€ for a single site for early birds. I'm working on the docs and on the webshop at the moment, but there are already several people from the forum using it for real projects, so if you are interested just write me a PM or signup to rock monthly to get notified when sales start ?? https://www.baumrock.com/rock-monthly/
  15. I thought that repeater pages have their own template, sorry. If that's not the case then just modify my hook to check the page's parents: Here the $page is a repeater item. You can inspect its parents like shown in line 1 and you can add something like shown in line 2 into your hook to only fire that hook that overrides the title if the parents have your repeater parent page. If not, then early exit of that hook. <?php $wire->addHookProperty("Page::title", function ($event) { $page = $event->object; if(!$page->parents->has("name=for-field-157") return; $event->return = $event->object->headline; });
  16. Ah, sorry - that's what I already showed in my previous post! Just find out the template of your repeater items and use the hook that I posted.
  17. If you compare both approaches it would be interesting if you share your findings. https://processwire.com/blog/posts/debugging-tools-built-in/ (Debug::timer) might be helpful and memory usage could also be interesting.
  18. Note that this does NOT help with scalability issues. Quite the contrary. It will keep two page fields in sync but it will store the data twice. So if you have lots of pages, you'll make your issues even worse.
  19. I'm thinking of removing ALFRED from RockFrontend. Is anybody at all using it in any projects??
  20. I guess the module uses something like $page->get('title|id') for the labels and since your page has no title field it falls back to the id. You can easily overwrite the "title" property of your page via hook! In this example I overwrite it for the "repeater_rpb_textgrid_items" template and set it to display the field "rpb_textgrid_headline" instead of "title": <?php $wire->addHookProperty("Page(template=repeater_rpb_textgrid_items)::title", function ($event) { $event->return = $event->object->rpb_textgrid_headline; });
  21. How many documents? How many users? If you only have a limited number then a simple page reference field would be all you need. Just add a field "readby" to your documents page and add users to that field via API. You just need to make sure that you don't have too many pages stored in the page reference field. So if you have many documents but just a few users add the page field to documents. If you have many users but just a few documents add the page field to the user template and add read documents to the field. If you have many documents and many users go with the custom table solution that I showed here:
  22. I'm quite sure you did, but just in case: Did you check if there is a plugin that can fix your issue? ?
  23. You have to read carefully. What I showed was the syntax for saveCustomField() method. You now posted the one for addCustomFieldToPageEditForm() - that are two different things. saveCustomField hooks into Pages::saveReady, therefore the $page is available as the very first argument of the HookEvent: $event->arguments(0) or $event->arguments('page') addCustomFieldToPageEditForm on the other hand hooks into ProcessPageEdit::buildForm, therefore the edited $page is available as $event->object->getPage() Your solution is fine as well, but it will only work for situations where the page id is available as a get parameter. So I'd recommend you read again my post/video about hooks here: https://processwire.com/talk/topic/18037-2-date-fields-how-to-ensure-the-second-date-is-higher/#comment-158164
×
×
  • Create New...