-
Posts
1,303 -
Joined
-
Last visited
-
Days Won
16
Everything posted by elabx
-
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(); } } });
-
image descriptions can't be changed in my repeaters?
elabx replied to rushy's topic in General Support
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. -
Latest best practice? - dynamic widgets within body field
elabx replied to Peter Knight's topic in General Support
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 .- 7 replies
-
- 3
-
- rich text
- hannah code
-
(and 1 more)
Tagged with:
-
Latest best practice? - dynamic widgets within body field
elabx replied to Peter Knight's topic in General Support
I have sometimes used a combination of repeater matrix with a "identifier field" that is later used as an attribute in a hannah code.- 7 replies
-
- rich text
- hannah code
-
(and 1 more)
Tagged with:
-
Change css and images through admin (custom admin page)?
elabx replied to Roych's topic in Getting Started
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); } ?> -
Add unique inputfield to LoginRegister registration form.
elabx replied to salmiak's topic in General Support
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; }); -
Maybe this one??
-
MathParser adds Intelligence to your Number Inputfields
elabx replied to bernhard's topic in Modules/Plugins
Maybe using the Fieldtype selector in the module autoload setting?? Though I guess that limits the compatibility minimum version. type=FieldtypeInteger|FiledtypeDecimal -
Thanks for the heads up!I haven't tried locally but will soon.
- 242 replies
-
- visual studio code
- vsc
-
(and 2 more)
Tagged with:
-
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.
- 242 replies
-
- 1
-
- visual studio code
- vsc
-
(and 2 more)
Tagged with:
-
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 ?
- 242 replies
-
- visual studio code
- vsc
-
(and 2 more)
Tagged with:
-
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.
-
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.
-
I've gone this way! And used the Google Anaytics API to retrieve the data if needed.
-
Move Composer's vendor folder outside of the web root folder
elabx replied to gmclelland's topic in General Support
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. -
$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.
-
[SOLVED] Best way to assign properties but each properties only once
elabx replied to dotnetic's topic in General Support
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. -
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; });
-
[SOLVED] Passing "parent page" to page creation via api
elabx replied to louisstephens's topic in API & Templates
Hahahahaha, early morning support, sorry guys -
[SOLVED] Passing "parent page" to page creation via api
elabx replied to louisstephens's topic in API & Templates
Use double quotes! -
maps Show maps with multiple markers in a reveal modal
elabx replied to Sorina's topic in Getting Started
I got it to work like this! https://jsfiddle.net/elabx/vysjwp01/ -
Check this post from Ryan:
-
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!
-
Is there any other place in the code where you actually create the repeater items themselves? Maybe that's missing.
-
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