Jump to content

elabx

Members
  • Posts

    1,303
  • Joined

  • Last visited

  • Days Won

    16

Everything posted by elabx

  1. You are getting into a looping issue because you are hooking into every page saved. I also think you have to hook into Pages which then has the need info in its arguments. wire()->addHookAfter('Pages::saved', function($event) { $page = $event->arguments(0); if($page->template == "user"){ $savedUser = $page; $userpage = wire('pages')->find("parent=Abos, name=".$savedUser->name); if ( count($userpage) == 0 ) { $page = new Page(); $page->template = 'Abos'; $page->parent = wire('pages')->get('/Abos'); $page->title = $savedUser->name; $page->save(); } } });
  2. The times this has happened to me and no errors were obvious, it was mod_security from Apache messing up with the POSTs from edit page.
  3. For example, I have a Galleries repeater field (or repeater matrix), named galleries and I want to render galleries within a text field. Each repeater has an images and title field. Let's say you fill one repeater item's title field with "Party gallery". Then, I have a hannah code that has a title attribute available and is used in the text fields like the following: [[gallery title="Party gallery"]] Then, in the hannah code's code (?), I do a selection like this one: $gallery = $pages->get("galleries.title=$title"); That way the $gallery variable will hold the gallery referenced by the title, which can be picked from setting the hannah code attribute making it very flexible cause then you can have all sort of settings and just pick whatever gallery you want. The pain point for the users is usually going to find out galleries titles, but most users have found it to be quite flexible. Maybe a custom CKEditor toolbar dropdown would complement this approach even better, filling it with gallery names available. Check this awesome module from @Robin S .
  4. I have sometimes used a combination of repeater matrix with a "identifier field" that is later used as an attribute in a hannah code.
  5. Something I've done that is quite useful is setup a Less parsing library like this one that accepts variables and then I pass the variables on to the rendering pipeline, this keeps my styles files clean from php code: Pardon the dirty code: <?php $variables = array( 'main-color' => $home->main_color , 'body-background' => $home->color_main_background, 'icon-colors' => $home->color_icons, 'menu-icon-color' => $home->color_menu, 'footer-gradient' => $home->color_footer_gradient, 'go-top-gradient' => $home->color_got_top_gradient, 'slide-background-color'=> $home->color_slides_background, 'slide-hover-background-color'=> $home->color_slides_hover_background, 'h2-titles-color'=> $home->color_h2, 'headings-font'=> $home->headings_font, 'footer-background' => $home->color_footer_background ); //Set up main file path and directory of imports. $less_files = array( $mainCssFile => $config->paths->templates . 'css/' ); $options = array( 'cache_dir' => $config->paths->assets . 'cache/less/', 'output' => $config->paths->templates. 'css/build.css', 'relativeUrls' => false, "strictMath" => "on"); try{ $css_file_name = Less_Cache::Get( $less_files, $options, $variables); }catch(Exception $e){ $log->save("less", $e); } ?>
  6. As for making the field required, from what I can tell from the source code you need to set the field in the user template as required so it is also required in the registration form. (but I also see that it checks if the field is InputfieldText) I guess you could also make an after hook in the buildForm method, and traverse the form to set the field you want as required, try placing this in site/ready.php and let me know if it worked: $this->addHookAfter('LoginRegister::buildRegisterForm', function($event) { $form = $event->return; $field = $form->get('the_unique_text_field_name'); $field->attr('required','required'); $event->return = $form; });
  7. Maybe using the Fieldtype selector in the module autoload setting?? Though I guess that limits the compatibility minimum version. type=FieldtypeInteger|FiledtypeDecimal
  8. Thanks for the heads up!I haven't tried locally but will soon.
  9. No issues for the moment, except can't get autocompletion to work :D. And yes @bernhard, it is a ProcessWire website with the wire folder and all but I'm guessing it might be the context in which i'm editing (SSH FS) and I'm actually loading as root a public_html with a lot of websites underneath it.
  10. Hi! Is there any configuration to get Intelephense autocompletion to work?? Or does it just need to bee installed and that's it?? Sorry, tried to figure out from the thread but just couldn't ?
  11. This is the sole reason also I'm stuck in prehistoric emacs setup, to easily work on servers, always a command away from connecting to a server and opening a folder. OMG it's finally here!! Gonna try this ASAP. https://marketplace.visualstudio.com/items?itemName=Kelvin.vscode-sshfs#review-details EDIT: OMG it works wonders, love this.
  12. In my experience YouTube always feels a bit clunky in comparison to hml5 video with feels more instantaneos, but could be made to work (I've only got it to be responsive with some js though), I agree the most "slick" solution is to use native html5 video and a CDN. I have personally used AmazonS3/Cloudfront for this.
  13. I've gone this way! And used the Google Anaytics API to retrieve the data if needed.
  14. Hi! Has anyone found a solutions for this? I have several sites that use the same composer modules i'd love if I could just install them globally for the user. Though suspecting from where the require_once happens, I feel my only choice would be using symlinks? Just made a comment also in the GitHub issue.
  15. $termine->filter("date>=today")->sort("date")->slice(0,10) I wonder also if this could also work, I could bet it does: $termine->filter("date>=today, sort=date, limit=10"); Keep in mind filter method is destructive.
  16. Would it work if you setup the properties beforehand? And maybe define a catalogue somewhere else with a page field (I do it in a parent page). So you have a text field and not a select field and one line per property. And set them up in a hook (I've done this in Pages::added if I remember correctly) Although this would requiere all fields to always appear on the page, and exclude them from rendering if their description field is not filled. I have also removed the add new button for this purpose through a hook in the inputfield render.
  17. Well, had to do this now for including a privacy policy link in a formbuilder label ? $wire->addHookAfter("InputfieldCheckbox::render",function($event){ $field = $event->object; $output = $event->return; $policyUrl = $this->pages->get("name=privacy-policy")->url; if($field->name == "privacy_policy"){ $output = str_replace("privacy policy","<a href='{$policyUrl}'>privacy policy</a>", $output); } $event->return = $output; });
  18. Hahahahaha, early morning support, sorry guys
  19. I got it to work like this! https://jsfiddle.net/elabx/vysjwp01/
  20. I would try using this function: https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/modules/Fieldtype/FieldtypeRepeater/FieldtypeRepeater.module#L432 Repeaters items are actual pages that have to be created, hence when you are iterating the field in your code counts 0 repeaters, because no repeaters exist!
  21. Is there any other place in the code where you actually create the repeater items themselves? Maybe that's missing.
  22. Mmm, I don't think this will be as straighforward, I think this is all performed in javascript: https://github.com/processwire/processwire/blob/master/wire/modules/Inputfield/InputfieldCKEditor/plugins/pwimage/plugin.js Maybe override the whole CKEditor module (copy the whole module to site/modules) and rewrite the line where the img tag is created, which i think is here: https://github.com/processwire/processwire/blob/master/wire/modules/Inputfield/InputfieldCKEditor/plugins/pwimage/plugin.js#L210
×
×
  • Create New...