-
Posts
6,671 -
Joined
-
Last visited
-
Days Won
366
Everything posted by bernhard
-
Hi @Sarnoc and welcome to the forum, It does not sound like you'll need any hooks or custom SQL to get what you are trying ? This page is your best friend: https://processwire.com/docs/selectors/ I think your setup is good as it is! I'd not recommend using repeaters for that. Pages are in general more flexible and better/easier to maintain in the long run in my opinion. I also wonder why the find operation does not work... IMHO it should. I guess your pages have a different NAME (not title)... Using TracyDebugger you can easily and quickly try such things: "poc" is a page reference field. And the referenced field has title="Jakob Enigl Pagetitle" and name="Jakob Enigl Pagename" That's why the first line does NOT work and the other lines do work. The first dump looks for the pagename (no subfield specified) and I guess it does work because the string is sanitized to a pagename (see last dump). When building your queries with user input or dynamic values it's sometimes easier and more readable to build your selectors as arrays:
-
Are you talking about the frontend or the backend? I don't understand your whole setup, I guess ? Where do you store your initial date (the one that is the reference to count the days to the date of the entry)? Is it like this? 2019/04/01 Foo Bar 2019/04/02 - Day 1 2019/04/05 - Day 4 2019/04/09 - Day 8 2019/04/02 Bar Foo 2019/04/05 - Day 3 2019/04/09 - Day 7
-
Hi @elabx, thx for asking ? Well, one (crucial) thing would be the javascript events. Maybe that could be added to kongondo's module, that's why I was asking for his opinion. Besides that I don't like how his module works (I'm picky, I know). We had some discussion about it (https://processwire.com/talk/topic/10804-module-runtimemarkup-fieldtype-inputfield/?do=findComment&comment=148083). And it was simply easier to have things under my control than modifying his version with custom hooks. But yeah.. It might not be necessary to have another module for this ?
-
I vote against a site profile approach... ? I guess I'm biased (I simply don't like site profiles at all), but how should any of the mentioned ideas work as a site profile? How would your customers get updates? What if they needed customizations? What if they want to integrate it in an existing project? Besides, I wonder if there is a market for commercial modules at all. Since Friday, the event booking suggestion got 15 votes. If 10% purchased such a software, that would mean 1.5 purchases... But maybe someone that has already released commercial modules could provide some insights. I think what PW would need is a good way to handle exactly what you mentioned above as your challenges: That's what @LostKobrakai has (kind of) tackled some time ago with his Migrations module and what I have started to tackle with my version of it. I think a proper way to handle such things would be the best addition to PW. This would also make it possible to have a proper workflow for staging/dev setups that have been discussed over and over again here in the forum.
-
Intelephense works great most of the time... Nevertheless sometimes I don't get proper results, see this example: Any ideas why I don't get "InputfieldForm" (and several others)? Edit: Ok, I changed the filename from InputfieldForm.module to InputfieldForm.module.php and it works. Does anybody have an idea how to make Intelephense index .module files? I already have a user settings for file associations linking .module to .php; That works for code colorization but not for the intellisense ?
- 246 replies
-
- visual studio code
- vsc
-
(and 2 more)
Tagged with:
-
Hi @MrSnoozles you are right - RockGrid is intended to load all data to the client at once. Doing this via paginated ajax calls would have a lot of side effects and is not planned. For example if you have column statistics showing the sum of all rows, that would not be possible when data was paginated (and not fully loaded into the grid). Also sorting would work totally different. aggrid supports this feature, but it would need a LOT more work to also support this in RockGrid. Not only for development of RockGrid but also for development of every single field/grid. When I have complex queries then I usually display only a subset of the data, for example all entries of year XXXX. You can see some performance tests here:
-
Thx kixe, I know that library, but I wonder where you have used it and what for ?
-
What do you need iframe resizer for?
-
Not another Markup Fieldtype ? https://github.com/BernhardBaumrock/FieldtypeRockMarkup What do you think of a Fieldtype that does nothing else then rendering runtime markup from files that you provide in the settings or at runtime? In addition to that, I'd like the field to trigger javascript events to be usable for other fieldtype modules (like a charts module or a grid module). Javascript events would be necessary on field load (ajax/non-ajax), on collapse of the field, on click of a tab. When working with charts and RockGrid this has sometimes become a pain and I've implemented (sometimes dirty) fixes for that in different modules in different ways. I think it would make sense to have a solid base for such kind of modules (fieldtypes) that use some kind of standard events for standard situations. I'm especially interested in your opinions @Beluga because of the upcoming RockTabulator module and @kongondo because of your existing module. I think there are already similar modules by @Robin S and @kixe ? Thx for your input ?
-
Great points @wbmnfktr! Thanks for pointing me to ploi.io @Mikie - looks like a good alternative to runcloud ? I'm using my own VPS's at reliable hosting companies in AUT/DE as for the reasons @wbmnfktr mentioned. Personally I don't do any installations on 3rd party hosting providers any more. For me it was always a pain at some point. For example one hoster just didn't have SSH access and there was no option to transfer the whole site at once. Transferring the whole site via FTP would have taken hours... that's really not worth the saving of 5€/month compared to having all on my VPSs and full control over everything and being efficient and fast. I've never had problems with my clients paying 5-10€/month for hosting on my server, when I tell them that setting up the website on their servers costs extra money and is a lot less efficient and more expensive in everyday operation. And that's not a lie! But it depends on your business... If you only do simple websites with no extra needs and maybe even no updates for several years, then it might be easier and better to choose a standard hosting provider that does everything for you (including invoicing, which can be tedious). 5-10€/month is for sure not worth doing everything on your own if you don't need any advanced features (like ssh, git support, etc).
-
RockMigrations1 - Easy migrations from dev/staging to live server
bernhard replied to bernhard's topic in Modules/Plugins
Thx for clarifying. I don't like the idea of code generators. Maybe because I'm not familiar with them. But I could think of some kind of central migrations queue system. Modules could "register" their migrations in a central place and make sure the order of execution is in a way that there are no conflicts. For example a migration could define requires => ['otherModule' => '0.0.3'] This could then run the migration in "myModule", execute "otherModule" until v0.0.3 and continue with executing "myModule" migrations afterwards. At the moment this is a little theoretical, because I usually do small iterations, push them to production and for the next iteration I have to identical states to start from. That's easy to handle. Sometimes I even do changes by hand, if that is no problem (eg the change does not affect the live system - like changing a typo in some textfield or the like). Also running a migration twice is usually not a problem at all. My api is designed in a way that, for example, if you create a field in your migration and the field already exists, it will just return that field. I'm not sure about this one. At the moment it feels like this is not the best idea, but I'm sure I've had a reason to do it this way ? It's alpha... things might change. I released it to get some feedback and input. And so far it did a great job on several updates across several sites ? -
I'm so lazy ? That's why I created RockModuleCreator some time ago... I didn't want to copy files, rename them, rename the class, lookup icon names etc... Not a lot to say... Simply upload your skeleton to github or similar, add placeholder tags like `#author#` or `#date#` and create modules quickly and easily. I'm happy to accept PRs if anyone wants to take this further... https://github.com/BernhardBaumrock/RockModuleCreator Available skeletons: https://github.com/BernhardBaumrock/RockMigrationsDemo https://github.com/BernhardBaumrock/RockProcessHello
- 2 replies
-
- 13
-
-
This is the thread for the old version of RockMigrations wich is deprecated now and has been renamed to RockMigrations1 Here is the latest version of RockMigrations: -- Old post from 2019 -- https://github.com/baumrock/RockMigrations1 Quickstart First make sure you have backups of your database!! Install RockMigrations Create this ready.php <?php /** @var RockMigrations1 $rm */ $rm = $this->wire('modules')->get('RockMigrations1'); $rm->migrate([ 'fields' => [ 'myfield' => ['type' => 'text'], ], 'templates' => [ 'mytemplate' => [], ], ]); Open your PW Backend and you'll see the new field and new template! Now add the new field to the template: <?php /** @var RockMigrations1 $rm */ $rm = $this->wire('modules')->get('RockMigrations1'); $rm->migrate([ 'fields' => [ 'myfield' => ['type' => 'text'], ], 'templates' => [ 'mytemplate' => [ 'fields' => [ 'title', 'myfield', ], ], ], ]); Reload your backend and inspect the template: Now let's add a label for our new field and make title+myfield 50% width: <?php /** @var RockMigrations1 $rm */ $rm = $this->wire('modules')->get('RockMigrations1'); $rm->migrate([ 'fields' => [ 'myfield' => [ 'type' => 'text', 'label' => 'My Field Label', ], ], 'templates' => [ 'mytemplate' => [ 'fields' => [ 'title' => ['columnWidth' => 50], 'myfield' => ['columnWidth' => 50], ], ], ], ]); That's all the magic! You can easily lookup all necessary properties in Tracy Debugger: Let us add a Textformatter as an example! Add the textformatter via the PW backend (not via RM), save the field and inspect via Tracy: Now add this data to your migration: <?php /** @var RockMigrations1 $rm */ $rm = $this->wire('modules')->get('RockMigrations1'); $rm->migrate([ 'fields' => [ 'myfield' => [ 'type' => 'text', 'label' => 'My Field Label', 'textformatters' => [ 'TextformatterEntities', ], ], ], 'templates' => [ 'mytemplate' => [ 'fields' => [ 'title' => ['columnWidth' => 50], 'myfield' => ['columnWidth' => 50], ], ], ], ]); Ok maybe you noticed that migrations are now running on every request which may slow down your site a lot! RM2 will have a feature to automatically detect changes and fire migrations automatically. RM1 does not have this feature, but I've used a technique in all my projects that fires migrations on every modules refresh. Simply wrap the migration in a fireOnRefresh method call: <?php /** @var RockMigrations1 $rm */ $rm = $this->wire('modules')->get('RockMigrations1'); $rm->fireOnRefresh(function() use($rm) { $rm->migrate([ 'fields' => [ 'myfield' => [ 'type' => 'text', 'label' => 'My Field Label', 'textformatters' => [ 'TextformatterEntities', ], ], ], 'templates' => [ 'mytemplate' => [ 'fields' => [ 'title' => ['columnWidth' => 50], 'myfield' => ['columnWidth' => 50], ], ], ], ]); }); How to remove things you created before you may ask? Use the declarative syntax: <?php /** @var RockMigrations1 $rm */ $rm = $this->wire('modules')->get('RockMigrations1'); $rm->fireOnRefresh(function() use($rm) { $rm->deleteField('myfield'); $rm->deleteTemplate('mytemplate'); }); Refresh your backend and everything is as it was before! PS: Make sure you have proper Intellisense support in your IDE to get instant help:
- 176 replies
-
- 18
-
-
-
Custom look for page reference field select, radio or checkbox etc
bernhard replied to sambadave's topic in General Support
wow, thx, totally missed/forgot that one! ? -
Well, just take a video with your phone ?
-
@Robin S there are lots of modal libraries, but the only reliable that I've found for including admin pages (iframes, html content, videos etc) in a modal is http://fancyapps.com/fancybox/3/ (and maybe magnific popup). What I've not found is a library that makes it easy to create panels just like the pw admin does. Where one can simply add class="pw-panel" and it loads in an iframe, sliding in from left or right, being resizable, hideable, reloadable etc...
-
Could you maybe create a screencast of this issue and report it on github? ?
-
It might be a good idea to tell us more about your goal ? Maybe there is a better solution to what you are trying to achieve with an additional field populated after the page is added from the page field... If I understand you correctly, you have a template "dog" with two page fields, one for "father" and one for "mother", right? So maybe you don't even need to populate this field, because you could just use another query. Or you could just use a saveReady hook, that set's the sex of the father to male and sex of the mother to female whenever the child dog is saved...
-
Am I the only one preferring panels a LOT over modals? ?
-
Custom look for page reference field select, radio or checkbox etc
bernhard replied to sambadave's topic in General Support
Hi @sambadave, if the available solutions do not fit, you can modify the markup of any field as you want quite easily. One option is the Inputfield::render hook. First, start with a general hook to check if everything works: // /site/ready.php $wire->addHookAfter("Inputfield::render", function(HookEvent $event) { bd('fired'); }); You should get lots of dumps when opening your page (using TracyDebugger of course): Make it conditional to only fire for your field and change the class to InputfieldSelect to be more specific: $wire->addHookAfter("InputfieldSelect(name=availability)::render", function(HookEvent $event) { bd('fired'); }); It will fire only once: The HTML is in the "return" property of the $event: $wire->addHookAfter("InputfieldSelect(name=availability)::render", function(HookEvent $event) { bdb($event->return); }); You can then modify this html like this: $wire->addHookAfter("InputfieldSelect(name=availability)::render", function(HookEvent $event) { $html = $event->return; $html = str_replace("value='1'", "value='1' style='background: red; color: white;'", $html); $html = str_replace("value='2'", "value='2' style='background: blue; color: white;'", $html); $html = str_replace("value='3'", "value='3' style='background: green; color: white;'", $html); $event->return = $html; }); For more complex modifications it's better to hook the field before it get's rendered (search the forum via google for ProcessPageEdit::buildForm). You can also see https://github.com/BernhardBaumrock/TemplatePreviewImages for a simple example of modifying inputfields and applying an additional library. -
FieldtypeHandsontable: Excel-like Inputfield
bernhard replied to bernhard's topic in Modules/Plugins
v0.0.9 adds support for dynamic rowHeaders. Previously they had to be manually defined via JavaScript. Now they can be defined by user input: -
Adding image to Page via API $page->images->add() (SOLVED)
bernhard replied to EyeDentify's topic in Getting Started
Why don't you just install TracyDebugger and try it out? It makes so many things so easy: -
Adding image to Page via API $page->images->add() (SOLVED)
bernhard replied to EyeDentify's topic in Getting Started
As simple as that: -
Sorry, of course it should be %Y-m-d% see https://www.php.net/manual/en/function.date.php
-
There's also a nice roadmap of tabulator: https://trello.com/b/rPZ0Yavc/tabulator-roadmap Looking really nice so far!