Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by elabx

  1. @bernhard updated it! For anyone that might come across adding something else on the admin theme's markup, here's a recommendation from Ryan: $src = "https://unpkg.com/alpinejs@3.10.2/dist/cdn.min.js"; $this->wire()->adminTheme->addExtraMarkup('head', "<script src='$src' defer></script>");
  2. @kongondo Also managed to load AlpineJS like this: https://github.com/elabx/AlpineJS Although only works with the edited core version files mentioned above lol Then on the Inputfield on init(), I can do: $this->modules->AlpineJS This was copied from: https://github.com/somatonic/JqueryDataTables Only adding the composer dependency since that's how I want to manage it through the Inputfield actually using Alpine
  3. Thank you both for your answers! I tried to remove the hook like you suggested but the script still gets appended twice in the presence of two of the same field ๐Ÿ˜‘. Also added the request here: https://github.com/processwire/processwire-requests/issues/468 Also made the edit here: https://github.com/elabx/processwire/commit/9a261c18a232845d92abe8e411fa48a381563dfd I also dig your version @bernhard , like, if I want defer without value, this kinda looks weird? array( [ 'defer' => ''] )
  4. 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.
  5. @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!
  6. I use this fantastic module: https://processwire.com/modules/video-or-social-post-embed/
  7. @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?
  8. 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.
  9. 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!
  10. Exactly this! Solved! Ohh!! This is neat ๐Ÿ˜ฎ Need to upgrade to latest RockMigrations, still on v1!
  11. 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?
  12. Seems to be getContext() is available until 3.0.162? https://processwire.com/api/ref/field/get-context/
  13. 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/
  14. 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; } } } });
  15. 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.
  16. 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.
  17. 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.
  18. 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!
  19. 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 ]); */ }); });
  20. There's also: https://processwire.com/api/ref/wire-array/get-values/
  21. Looks like access control issue ? Can you try: $pages->get("name=reports")->children("check_access=0,report_meta_details.report_type.title=Global")->each("report_meta_details.report_type.title"); I wonder, if you try this one, does it behave the same way? $pages->find("parent.name=reports, report_meta_details.report_type.title=Global")->each("report_meta_details.report_type.title");
  22. 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??
  23. 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?
  24. 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.
  • Create New...