-
Posts
6,662 -
Joined
-
Last visited
-
Days Won
366
Everything posted by bernhard
-
SuperUser account access only on development server
bernhard replied to NikNak's topic in General Support
You could create a dedicated user for your client and only allow logins of that user on the development domain. -
Why is creating pages any worse than populating a repeater? I'd prefer pages I guess. I don't understand the last part. Could you please explain what you mean exactly? ---- I'd go with pages and build a custom Inputfield for selecting icons. It's really not that hard and definitely the best UX ? Once you have answered the above questions I might be able to help ?
-
You can use custom page classes and add a getPageListLabel() method: It can be a problem though that this markup also ends up in the main navigation and also in page select fields. You can hide those elements via CSS though: // site/classes/YourPageClassPage.php public function getPageListLabel() { return "<span class=foo>foo</span> " . $this->title; } /* /site/templates/admin.less */ .PageListPage.label .foo { border: 2px solid red; } Another option is to use RockMigrations + MagicPages, then you can simply add "pageListLabel()" instead of "getPageListLabel()" and you'll get the modified label in the pagetree but not in the menu. This is the hook I'm using: https://github.com/baumrock/RockMigrations/blob/85c28fb97411f2af1ab3c77d3911b777d3f77ccf/MagicPages.module.php#L268-L290
- 1 reply
-
- 1
-
-
Add custom options to InputfieldSelect via a hook
bernhard replied to a-ok's topic in General Support
Had the same need today and was not able to get it working properly. The quoted version did only work if I had some options set in the inputfield's config, which is not good. I came up with this solution (that only works for single selects): <?php $wire->addHookBefore('InputfieldInteger::render', function ($event) { $inputfield = $event->object; if ($inputfield->name != "your_fieldname") return; $f = new InputfieldSelect(); $f->name = $inputfield->name; $f->value = $inputfield->hasPage->{$inputfield->hasField}; $f->setOptions([1 => 'UK', 2 => 'USA', 3 => 'Etc etc']); $event->return = $f->render(); $event->replace = true; }); This works because it simply stores the option's id in the integer field so it does not try to sanitize for options that it does not have. -
[Solved] TinyMCE symbolbar are not on top in frontend edit (bug?)
bernhard replied to Tiberium's topic in RockPageBuilder
Hi Denis, thx. That's already fixed in the latest version on the dev branch ? Sorry for the trouble! I'll merge that soon!- 1 reply
-
- 3
-
-
-
Permissions for some modules are getting added as unpublished?
bernhard replied to gornycreative's topic in General Support
@gornycreative have you seen https://github.com/baumrock/RockMigrations/issues/50 ? Or was that you posting the issue? ? -
This would also work: <?php if($page->matches("id=1042|1043")) ... ?
-
Assigning a value by page name (I didn't know you can do this)
bernhard replied to Jonathan Lahijani's topic in Tutorials
Thx for sharing, didn't know that as well! Not sure if your example is real or not, but I'd recommend something like this: $order->setOrderStatus('pending'); So your $page should better be an OrderPage (custom page class) and that pageclass should have this method: <?php ... public function setOrderStatus($status) { $this->setAndSave( 'order_status', $this->wire->pages->get("/path/to/order-statuses/$status") ); } I know the benefit looks little, but the code does not only get cleaner to read: <?php $page->setAndSave('order_status', $pages->get('/path/to/order-statuses/pending/')); // vs $order->setOrderStatus('pending'); It gets also more error-proof (what if someone/something created another page with name "pending" somewhere else in the tree? And not to forget your system will be better and easier to maintain. Imagine for example you change the path of your statuses one day. You only change the path in setOrderStatus() and you are done, rather than finding all instances of ->setAndSave(...). Also maybe one day the client want's E-Mail notifications on changed statuses... Simply go to setOrderStatus() method and add the mail code there. If you have several ->setAndSave('order_status', 'something') sprinkled around you might be tempted to add the mail sending on several locations or you might forget it somewhere and you'll have introduced an unnecessary bug ? PS: I'd even more prefer setStatus() but that's already taken by the Page baseclass. updateStatus() would also be an option. But setOrderStatus() might be the clearest anyhow ? -
I added echo "$file<br>" in WireClassLoader.php:354 right above the is_file() and this is what I get: /path/to/user/www/tmp/processwire-dev/wire/core/ModulesInfo.php /path/to/user/www/tmp/processwire-dev/wire/core/ModulesClass.php /path/to/user/www/tmp/processwire-dev/wire/core/ModulesFlags.php /path/to/user/www/tmp/processwire-dev/wire/core/ModulesFiles.php /path/to/user/www/tmp/processwire-dev/wire/core/ModulesConfigs.php /path/to/user/www/tmp/processwire-dev/wire/core/ModulesLoader.php /path/to/user/www/tmp/processwire-dev/wire/core/WireDatabasePDOStatement.php /path/to/user/www/tmp/processwire-dev/wire/core/WireCacheDatabase.php /path/to/user/www/tmp/processwire-dev/wire/core/DefaultPage.php ProcessWire\DefaultPage.php /path/to/user/www/tmp/processwire-dev/site/classes/DefaultPage.php /path/to/user/www/tmp/processwire-dev/wire/core/HomePage.php ProcessWire\HomePage.php /path/to/user/www/tmp/processwire-dev/site/classes/HomePage.php /path/to/user/www/tmp/processwire-dev/wire/core/PageProperties.php /path/to/user/www/tmp/processwire-dev/wire/core/PageValues.php /path/to/user/www/tmp/processwire-dev/wire/core/AdminPage.php ProcessWire\AdminPage.php /path/to/user/www/tmp/processwire-dev/site/classes/AdminPage.php /path/to/user/www/tmp/processwire-dev/wire/core/UserPage.php ProcessWire\UserPage.php /path/to/user/www/tmp/processwire-dev/site/classes/UserPage.php /path/to/user/www/tmp/processwire-dev/wire/core/RolePage.php ProcessWire\RolePage.php /path/to/user/www/tmp/processwire-dev/site/classes/RolePage.php /path/to/user/www/tmp/processwire-dev/wire/core/WireInputDataCookie.php /path/to/user/www/tmp/processwire-dev/wire/core/PermissionPage.php ProcessWire\PermissionPage.php /path/to/user/www/tmp/processwire-dev/site/classes/PermissionPage.php /path/to/user/www/tmp/processwire-dev/wire/core/FileLog.php /path/to/user/www/tmp/processwire-dev/wire/core/PagesRequest.php /path/to/user/www/tmp/processwire-dev/wire/core/PagesPathFinder.php /path/to/user/www/tmp/processwire-dev/wire/core/AdminThemeFramework.php /path/to/user/www/tmp/processwire-dev/wire/core/WireMarkupRegions.php Then I added this: if($file === "ProcessWire\DefaultPage.php") { echo var_dump(Debug::backtrace()); } // result array(9) { [0]=> array(2) { ["file"]=> string(34) "/wire/core/WireClassLoader.php:313" ["call"]=> string(81) "WireClassLoader $classLoader->findClassInPaths("DefaultPage", [ 'ProcessWire\' ])" } [1]=> array(2) { ["file"]=> string(28) "/wire/core/Templates.php:862" ["call"]=> string(39) "class_exists("ProcessWire\DefaultPage")" } [2]=> array(2) { ["file"]=> string(28) "/wire/core/Template.php:1441" ["call"]=> string(45) "$templates->getPageClass(Template $obj, true)" } [3]=> array(2) { ["file"]=> string(31) "/wire/core/PagesLoader.php:1312" ["call"]=> string(24) "Template->getPageClass()" } [4]=> array(2) { ["file"]=> string(24) "/wire/core/Pages.php:217" ["call"]=> string(30) "PagesLoader->getById(array(8))" } [5]=> array(2) { ["file"]=> string(30) "/wire/core/ProcessWire.php:625" ["call"]=> string(14) "$pages->init()" } [6]=> array(2) { ["file"]=> string(30) "/wire/core/ProcessWire.php:582" ["call"]=> string(47) "ProcessWire $wire->initVar("pages", Pages $obj)" } [7]=> array(2) { ["file"]=> string(30) "/wire/core/ProcessWire.php:315" ["call"]=> string(36) "ProcessWire $wire->load(Config $obj)" } [8]=> array(2) { ["file"]=> string(13) "/index.php:52" ["call"]=> string(43) "ProcessWire $wire->__construct(Config $obj)" } } Any ideas? Maybe I should better create an issue for PW itself?
-
Hey @adrian just installed a new pw instance (dev) for testing and got this error: ErrorException: is_file(): open_basedir restriction in effect. File(ProcessWire\BasicPagePage.php) is not within the allowed path(s): (/path/to/user/www:/path/to/user/files:/path/to/user/tmp) in /path/to/user/www/tmp/processwire-dev/wire/core/WireClassLoader.php:354 Stack trace: #0 [internal function]: Tracy\Bar->Tracy\{closure}(2, '...', '...', 354) #1 /path/to/user/www/tmp/processwire-dev/wire/core/WireClassLoader.php(354): is_file('...') #2 /path/to/user/www/tmp/processwire-dev/wire/core/WireClassLoader.php(313): ProcessWire\WireClassLoader->findClassInPaths('...', Array) #3 [internal function]: ProcessWire\WireClassLoader->loadClass('...') #4 /path/to/user/www/tmp/processwire-dev/wire/core/Templates.php(878): class_exists('...') #5 /path/to/user/www/tmp/processwire-dev/wire/core/Template.php(1441): ProcessWire\Templates->getPageClass(Object(ProcessWire\Template), true) #6 /path/to/user/www/tmp/processwire-dev/wire/core/PagesLoader.php(1312): ProcessWire\Template->getPageClass() #7 /path/to/user/www/tmp/processwire-dev/wire/core/PagesLoader.php(521): ProcessWire\PagesLoader->getById(Array, Object(ProcessWire\Template)) #8 /path/to/user/www/tmp/processwire-dev/wire/core/Pages.php(289): ProcessWire\PagesLoader->find('...', Array) #9 /path/to/user/www/tmp/processwire-dev/wire/core/Wire.php(419): ProcessWire\Pages->___find('...', Array) #10 /path/to/user/www/tmp/processwire-dev/wire/core/WireHooks.php(968): ProcessWire\Wire->_callMethod('...', Array) #11 /path/to/user/www/tmp/processwire-dev/wire/core/Wire.php(484): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Pages), '...', Array) #12 /path/to/user/www/tmp/processwire-dev/wire/core/Page.php(3968): ProcessWire\Wire->__call('...', Array) #13 /path/to/user/www/tmp/processwire-dev/wire/core/PageTraversal.php(132): ProcessWire\Page->_pages('...', '...', Array) #14 /path/to/user/www/tmp/processwire-dev/wire/core/PageTraversal.php(157): ProcessWire\PageTraversal->children(Object(ProcessWire\HomePage), '...', Array) #15 /path/to/user/www/tmp/processwire-dev/wire/core/Page.php(1883): ProcessWire\PageTraversal->child(Object(ProcessWire\HomePage), '...', Array) #16 /path/to/user/www/tmp/processwire-dev/site/assets/cache/FileCompiler/site/modules/TracyDebugger/panels/RequestInfoPanel.php(484): ProcessWire\Page->child('...') #17 /path/to/user/www/tmp/processwire-dev/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Bar/Bar.php(143): RequestInfoPanel->getPanel() #18 /path/to/user/www/tmp/processwire-dev/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Bar/Bar.php(115): Tracy\Bar->renderPanels('') #19 /path/to/user/www/tmp/processwire-dev/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Bar/Bar.php(89): Tracy\Bar->renderPartial('...') #20 /path/to/user/www/tmp/processwire-dev/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Debugger/DevelopmentStrategy.php(123): Tracy\Bar->render(Object(Tracy\DeferredContent)) #21 /path/to/user/www/tmp/processwire-dev/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Debugger/Debugger.php(319): Tracy\DevelopmentStrategy->renderBar() #22 [internal function]: Tracy\Debugger::shutdownHandler() #23 {main} Tracy was installed some seconds before, so it should be the latest version ?
-
Ah, true. Now I remember I checked that yesterday but didn't think of that any more ? Then I'm out of ideas ?
-
Maybe the permissions page has moved somehow? That would explain why name=permissions finds something and providing the path does not.
-
What you are seeing is a display glitch. The "Recently Found and Installed Modules" should be on a separate tab called "new", so it looks like you don't have any missing modules?! Not sure why the tab is visible in that case though.
-
You could try to delete the row of your module in the "modules" database table. That would mean that the module is uninstalled. Then you could check if the module get's installed automatically on the next page load or modules refresh. If it get's installed you could add something like this to your install() method of the module: bd(debug_backtrace()); die(); In that backtrace you should then see what is triggering the installation of the module.
-
I can't reproduce this behaviour. Both return the page properly.
-
Just install the module on another ProcessWire installation. If it's the same behaviour there the issue is in your module. If it's different, then the issue is in your current project. ?
-
Is it ok to use MarkupRegions on one template only?
bernhard replied to JayGee's topic in API & Templates
Uneducated guess: I think it should be fine. -
Usability improvements for Setup > Fields in backend
bernhard replied to MSP01's topic in Wishlist & Roadmap
Sounds exactly like what the admin search does? ? -
@gebeer I'd love to have better docs, but I don't like github wikis - that's why I built my own docs system on baumrock.com It reads module docs from markdown files that are stored under the /docs folder within the module. See https://github.com/baumrock/RockFrontend/tree/main/docs for example. Would be great if you could create a PR for RockMigrations that show that info on my website like here: https://www.baumrock.com/en/processwire/modules/rockmigrations/docs/deployments/ I'm busy with client work for the next weeks, so any help is very welcome ?
-
Have you seen RockLanguage? There was no feedback at all...
-
Hey Jens this works great, thank you! {* page background image *} <picture id="page-bg"> <source media="(min-width: 1400px)" srcset="{$home->backgroundImageUrl(1920)}"> <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAAtJREFUGFdjYAACAAAFAAGq1chRAAAAAElFTkSuQmCC" alt="Page Background"> </picture> And the css: body, html { height: 100%; width: 100%; } #page-bg img { position: fixed; left: 0; top: 0; width: 100%; height: 100%; object-fit: cover; z-index: -1; } I'm using a transparent pixel data-url by default (taken from https://shoonia.github.io/1x1/#00000000).
-
Provide a way to define / save / sync fields in the code base
bernhard replied to Rasso's topic in Wishlist & Roadmap
I'm not 100% happy with that wording. No offense, just want to be clear on that. It's not that I don't want to support RepeaterMatrix to push sales of RockPageBuilder. I'm just not using RepeaterMatrix any more because RockPageBuilder is far better for what I use it and it integrates well with RockMigrations. RockMigrations is a module containing thousands of hours of work that you get for free and that does not pay any bills for me. I just can't put any (more) unpaid work into it unless I need the features for my own work. But I'm happy to support RepeaterMatrix and any other pro field of Ryan if people provide PRs even though that might mean less sales for RockPageBuilder. I'd be even more happy if @MarkE had a look at RockMigrations and used it as common base so that we can work together on an api that does all the heavy lifting - independent from wether it is used by RockMigrations or MarkE's GUI. And even more happy, of course, if we had a migrations API in the core... -
I'm working on a website where I want to add an image as background: The image comes from a PW images field. So I can't add the image via CSS... I'm doing it like this: <html lang="de" class="uk-background-muted" style="background-image: url(<?= $site->bgImgUrl() ?>)"> In CSS I have this: html { height: 100vh; background: no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } So far, so good. But I don't need that image on mobile, as it will never be visible. I only need it for screen sizes > 1440px. Any ideas how I could do that? I tried adding a <style> tag with @media(min-width: 1440px) { ... } </style> but that did not work. As soon as I placed it as "style" attribute of the html tag it worked. Thx for your help ?
-
I've never tried it myself, but you should never change anything inside the /wire folder. Use /site/config.php instead
-
Why do you want to do that? You can configure that via $config->pageNumUrlPrefix, but what you are trying to do is not possible by default (and maybe not a good idea at all). By adding the slash you basically let it look like another layer of the pagetree (or of your sitemap), but that's not the case, so I'd say it's logically incorrect. Also see here: