Jump to content

elabx

Members
  • Posts

    1,496
  • Joined

  • Last visited

  • Days Won

    21

Everything posted by elabx

  1. Just noticing I actually messed up that module with a commit I made but someone already sent a fix, let's hope it gets pushed.
  2. @LexSanchez So, I actually introduced a bug in the module with my last PR sorry about that ?, @gmclelland seems to have pushed a fix for this in this PR, maybe also push the version? Thanks again!
  3. I use this fantastic module: https://processwire.com/modules/video-or-social-post-embed/
  4. @kongondo just out of curiosity, do you know what it would take if we wanted to share the same AlpineJS source for our modules? Have a ModuleJS derived AlpineJS module?
  5. 1000% something like this would be really nice! Do you keep track of where you have injected it somehow? I has previously solved loading it with the following hook on an Inputfield: $this->addHookAfter('AdminTheme::getExtraMarkup', function ($e) { $parts = $e->return; $parts['head'] .= "<script defer src='https://unpkg.com/alpinejs@3.10.2/dist/cdn.min.js'></script>"; $e->return = $parts; }); But then noticed Alpine got injected multiple times if I used the field in a repeater for example, within a page with the same field.
  6. Hi! I am adding Alpine.js to work with an Inputfield I'm building: public function renderReady(Inputfield $parent = null, $renderValueMode = false){ $this->config->scripts->add("https://unpkg.com/alpinejs@3.10.2/dist/cdn.min.js"); parent::renderReady($parent, $renderValueMode); } But seems to be that it requires the "defer" attribute to work correctly, otherwise I get a lot of errors from Alpine. From what I understand, the way the AdminThemeUikit loads the scripts is done here (wire/modules/AdminTheme/AdminThemeUikit/_head.php): // line 55 foreach($scripts as $file) { echo "\n\t<script type='text/javascript' src='$file'></script>"; } I also tried hooking into the AdminThemeUikit::renderFile to basically edit the output after finding the line where the alpine.js is loaded, but it happens multiple times if I setup different fields of the same type in the page (and maybe too hackish anyway??) Does anyone think it's worth making a pull request to make this more configurable? Maybe a hookable AdminThemeUikit:renderScriptTag($filename, $options) method in AdminTheme? I feel it makes sense to be able to add this attributes, since defer is now sort of standardized from what I read around the internet. foreach($scripts as $file) { $adminTheme->renderScriptTag($file); } I tried looking into initializing Alpine components any other way but had no success figuring out how to, yet ? Thanks for further answers!
  7. Exactly this! Solved! Ohh!! This is neat ? Need to upgrade to latest RockMigrations, still on v1!
  8. Hi! @thetuningspoon this is a very old thread haha but wondering if you managed to figure this out? Maybe through a hook after page add?
  9. Seems to be getContext() is available until 3.0.162? https://processwire.com/api/ref/field/get-context/
  10. Just to elaborate on another possible method, since getOptions() returns a SelectableOptionArray inheriting from WireArray, you could also do: $columns = $options->slices(3); https://processwire.com/api/ref/wire-array/slices/
  11. Maybe something like this, but I'm not entirely sure it will work, place it on ready.php: $wire->addHookBefore('Inputfield::render', function($event){ // the field where the field to hide exists $page = $inputfield->hasPage; $inputfield = $event->object; if($inputfield->name != "field_to_hide_if_parent") return; if($page->id){ // maybe check for children of specific type? if($page->parent->template == "specific_type_of_page"){ // the condition on the parent page? if($page->parent->multiselect_field->name == "some-name"){ $inputfield->collapsed = Inputfield::collapsedHidden; } } } });
  12. Yeah your approach seems reasonable, would love to know if you manage to solve with with just the access control. I had always used the isLoggedin() method, and never ocurred to me that it'd be reasonable to just disable 'view' for guests in a specific template. I mean, if it can actually work like that haha.
  13. What version of PW are you using? Can you try doing Modules > Refresh? Would seem like the LogEntriesArray class was not compiled into the processwire namespace.
  14. Wow! In general I think it's a huge benefit for the community to have a more opinionated way of doing frontend, so congrats on this is amazing module! I have no further comments until I try it fully but from what I see in the video it looks fantastic.
  15. Perfectly understandable! I have learned the bad way (writing docs that no one reads lol) that some people just prefer videos! So I think it's a really good resources despite the effort it requires! They give so much information that might be taken for granted in a text documents. So rather than one or the other I think both tackle different "moments" throughout a person's learning process and also preferences. I prefer without music, but that's just a preference I guess?? It is a REALLY great video!! I skipped a few parts, but watched around 50% of it, will watch it fully later. Not sure if you have previous experience recording/editing etc, but nonetheless this video is RockSolid (...?)! Also the audio is really good! Not an expert myself, but no noise or anything distracting on this end. I guess each topic on video production is a rabbit hole!
  16. This doc page has a very good example on how to setup a hook when the page is saved: https://processwire.com/api/ref/pages/saved/#pwapi-hooking, so something like this placed on site/ready.php should work: $wire->addHookAfter('Pages::saved', function(HookEvent $event) { $page = $event->arguments(0); // parent-page-template is the name of the template that is parent of the pages you want to edit if($page->template != "parent-page-template") return; $page->children->each(function($child) use ($page){ $child->another_field = $page->another_field; $child->save('another_field'); /* another option I like when setting multiple fields $child->setAndsave([ 'title' => $page->title, 'another_field' => $page->another_field ]); */ }); });
  17. There's also: https://processwire.com/api/ref/wire-array/get-values/
  18. Yeah mate! I was there in your exact same position, way less inexperienced when I arrived here barely knowing programming, web development, etc.. and here I am, breaking less things by the day thanks to everyone around here. ? Let me know how it goes! By the way, what development environment are you using??
  19. You can access it like: $this->database->getIndexes('my_table') Or wire('database')->getIndexes('my_table'); EDIT: Your code seems correct ? Can you paste the error thrown?
  20. Hi @Jacques! Welcome to the forums! I'd say the easiest would be to install it with composer if you are able to install composer and I'd argue that it's worth the investment in time to learn a bit of composer! At least just to run a composer require command, which is all you need right now! Have you seen this blog post?? https://processwire.com/blog/posts/composer-google-calendars-and-processwire/#installing-the-module-with-composer You don't need to install composer on the server, composer will download dependencies in a folder called /vendor in the installation's root folder and you can upload this folder just fine to the server. I would be really hard to break the site by just doing "composer require square/square", but in any case it does happen after that command, just delete the vendor folder. Are you familiar with CLI tools?? Maybe it's the first step! To learn how to execute a CLI program?? Are you on mac or windows?? If you're on mac I might be able to help. I see a manual installation guide to on square docs page! Did you see that? It might suite best with the knowledge you have now, though you'd need to adapt it to your own templates. Development aside, looking at the actual problem, maybe Pro module FormBuilder would be helpful if you have the budget to spend on it, and instead of Square you could use Stripe and that might might just be and almost plug and play solution depending on additional logic that do want to handle. Don't hesitate to come back and ask even if it seems like something "super obvious" or "dumb" in your view, this is a welcoming community for everyone no matter their experience.
  21. OMG what is this gem I hadn't seen! Thanks @Gideon So!
  22. I had not! ? Thanks! Let me read the module's readme and I might come back with questions ?
  23. So it goes like this, you create a migration file under the Setup > Migrations. This is a "Default" type of migration. Which is the one I only use, since with RockMigrations the whole API work is abstracted so nicely that working with the "data schema" (meaning ALL the config in processwire) is really more simple, so no need for the specific migrations types. <?php class Migration_2022_06_02_11_42_58 extends Migration { public static $description = "Do some awesome migrations stuff"; public function update() { // Put your migration code here $rm = wire('modules')->get('RockMigrations'); $rm->migrate([ 'fields' => [ 'button_label' => ['label'=> 'Button Label', 'type' => 'text'] ] ]); } public function downgrade() { // Put your rollback code here } } Then this runs either through the UI under Setup > Migrations or the CLI included in the Migrations module. We could say one "caveat" is that to use the CLI you need to install the Migration module through composer as the CLI tool has dependencies assuming them. So every time I wan to to push a migration to the live site, the pipelines I use for deployment (Bitbucket Pipelines) rsync's the new files, then triggers on the server: php /path-to-website/site/modules/Migrations/bin/migrate run Or for anyone reading this not familiarized with CI/CD pipelines, just log into the server and run the command. So "migrate run" runs all "pending" migrations. Previously run migrations are already tracked as migrated, so they won't run again. cc @MrSnoozles. I DO NOT, have an automated rollback solution yet, in terms of the CI/CD pipeline. So if I break something, I just move forward with another migration. Let me know if it sounds I'm skipping something, wrote this a bit quickly!
  24. @MrSnoozles You could take a look at using Migrations + RockMigrations (which work great hand by hand!) which satisfies exactly this. So you only substitute the "migration files" system, but use the invaluable abstractions from RockMigration. @bernhard interesting idea the tracking within the fields!
  25. No worries mate! I precisely saw this issue commented here: https://github.com/processwire/processwire-issues/issues/1569 Did you see that or arrived to the solution by chance?
×
×
  • Create New...