Federico

Members
  • Content Count

    103
  • Joined

  • Last visited

Community Reputation

15 Good

About Federico

  • Rank
    Sr. Member
  1. Federico

    Just a quick question, as I wasn't able to find any answer over this tread: is the scf module capable of manage file uploads (therefore send email with attachments)? Because my form gets error as soon as I attach a fileUpload fieldtype to the form, so no way for me to manage it Much appreciated
  2. Federico

    Hi, is there a clean way (not touching the module) to get fields labels instead of fields name in the email content text? //Line 464 foreach ($this->allFields as $inputfield) { $message[] = $inputfield .': ' . $this->sanitizer->textarea($this->input->post->{$inputfield}); } to something like this (not working...)? //Line 464 foreach ($this->allFields as $inputfield) { $message[] = $inputfield->label .': ' . $this->sanitizer->textarea($this->input->post->{$inputfield}); } thanks! --- Amendment: Here's how I've approached to get this done, maybe someone else might be interested: $message = array(); $message[] ='Some description...'; $message[] = '---'; $message[] = 'Name Surname: ' . $input->post->mail_name; $message[] = 'Partecipa il 7 Luglio? ' . ($input->post->mail_option_01 == 1 ? 'Si.' : 'No.'); $date = new \DateTime(); $message[] = 'Date: ' . $date->format('Y-m-d'); $emailText = implode("\r\n", $message); // in option array 'emailMessage' => $emailText, Cheers!
  3. @elabx that's great, I've just tested in ready.php and it works as expected. Good hook! I was getting close to this but I didn't know about the possibility to ad executeSomething right in the hook method. Thank you!
  4. Hi there, adding a function in ready.php (like I normally do in custom module) throws an error, for obvious reasons. How can I implement a hookable url within the ready.php (admin side)? for instance, if I hook a pageLister execution to add a button to it like this: $wire->addHookAfter("ProcessPageLister::execute", function($event) { if(wire('page')->id === 1413) { // the particular Lister instance page id $out = $event->return; $out .= ''; $btn = wire('modules')->get("InputfieldButton"); $btn->attr('data-href', "./addNewRecordal"); $btn->addClass("pw-modal"); if(!$this->config->ajax) $out .= $btn->render(); $event->return = $out; } } How can actually create a virtual url for that button? in a custom module it can be achieved like this: public function ___executeAddNewRecordal() { // // Create new page and redirect to its edit section $p = new Page(); $p->template = '02_template'; $p->parent_id = 1040; $p->name = 'recordal_' . $pageRecordalsMicrotime; $p->title = 'Recordal_' . $pageRecordalsMicrotime; $p->created_users_id = $this->user->id; $p->of(false); $p->save(); $this->session->redirect(wire('config')->urls->admin."page/edit/?id={$p->id}&modal=1"); } ..but in ready.php this is not possible. The tricky thing is that I have to hook a modal, I think, and this is not achievable via PHP afaik. Any hint? thanks
  5. Hello, I'm sure it requires a simple hook to hide the entire Pages tab in admin (for non-superusers), but none of the post in this forum nor the hooks directory seem providing an answer as far as I know. looking for adding the hook in ready.php, like this example $wire->addHookAfter('Page::listable', function(HookEvent $event) { // BUT I AM LOOKING TO HOOK THE ENTIRE TAB CALLED PAGES, NOT JUST THE LIST INSIDE $page = $event->object; $user = $this->user; if($this->wire('user')->hasPermission('example')) { $event->return = false; } }); someone more experienced? thanks a lot
  6. Hi @bernhard, my use case is to find this type of hook for the main navigation and prepend or append something to it. In Reno Admin theme (but also in the default admin theme too) we could achieve this with the following code $wire->addHookAfter('AdminThemeRenoHelpers::topNavItems', function($event) { $out = $event->return; $out .= '<li><img src="path/image.png"></li>'; $event->return = $out; }); Whereas you cannot leverage a similar hook to the Uikit theme (the latter soon to be the default theme). Am I correct?
  7. Hello pw community, is it possible to add some hook functions to the Uikit theme as well? I see all others themes (default and Reno) have extensive hooks capabilities, whereas the Uikit based theme in the admin has only the ___breadcrumb available. I am looking specifically to hook the masterhead navigation, but I believe the array of requests might be larger. I was discussing this on another thread @ryan sorry to bother you, maybe you already gave it some thoughts about. Do you think this will require intense work? Thank you very much!
  8. At the moment the only way to achieve this in the Uikit Admin Theme is via javascript route, as described by Lahijani in this thread
  9. well after many attempts, I've found that this working solution doesn't work for the Uikit Admin theme, as the latter has no helper file (yet, whereas all others admin theme have). pity!
  10. Looking for suggestions on how to insert a dropdown menu next to the admin navigation (Pages, Setup, Modules, Access, DropdownMenu), with uikit3 will be something like this one I see how to hook and modify the module page title and the breadcrumb $this->addHookBefore('Process::execute', function (HookEvent $event) { $process = $event->object; $event->wire('breadcrumbs')->removeAll(); $event->wire('processHeadline', 'customTitle'); $event->wire('processBrowserTitle', 'customTitle'); }); but not sure how to hook the main navigation to add new item. I see this executeNavJson in the Hooks methods, but doesn't return enything $this->addHookBefore('Process::executeNavJSON', function (HookEvent $event) { $process = $event->object; // @var Process $process bd($process); // Tracy is not even thrown }); Did I miss any docs for this?
  11. Hi there, sorry for raising this up, but I think it is not entirely correct to leave this as "solved", because I've just discovered that all the hook code above will actually add new <form> tag for each repeater, leading to a code mess and nested forms.. $this->pages->addHookAfter('Inputfield::render', function (HookEvent $event) { //$page = $event->arguments(0); $field = $event->object; //substr takes the first 13 letters to match the repeater_item if (substr($field->name, 0, 13) === 'repeater_item' && $this->page->name === 'book') { $id = str_replace('repeater_item_', '', $field->name); $form = wire('modules')->get("InputfieldForm"); $repeaterBtn = wire('modules')->get("InputfieldButton"); $repeaterBtn->attr("value", "Generate Brochure in panel"); $repeaterBtn->attr("type", "button"); $repeaterBtn->attr("id+name", "button_form_$field->name"); $repeaterBtn->attr("data-href", "./testa/"); $repeaterBtn->addClass("ui-priority-secondary "); $repeaterBtn->addClass('pw-panel button_export2pdf'); $form->append($repeaterBtn); $myForm = $form->render(); $event->return .= $myForm; } }); by calling Inputfieldform here, eventually the module will load these new button in a new form tag, the latter nested into the main form tag room for improvement?
  12. Thanks @BitPoet, I see the point of the regular page load on the iframe via data-href link. Could you be more specific on how deal with pw-panel via ajax? I think it will be useful also for others pw users. I have this ajax call which simply returns all form values. How do you manually fire such panel/modal request via ajax? $.ajax({ type: 'post', url: "./customPage/", data: $("form").serialize(), success: function(data){ //$("#form_book").html(value); //alert(buttonClickedID); } }); Maybe on a success function?
  13. Hi there, no post all over the forum, which seems strange to me given the relevance. I have a custom admin process module with a need of displaying in panel window the form submitted values trough ajax. in essence the pw-panel and pw-modal windows when opened they only read non-ajax conditional, therefore the following code in pw-panel will output only "no ajax" $out .= ''; if ($this->wire('config')->ajax) { foreach($this->input->post->ClickedRepeaterID as $key => $value){ $p = $this->pages->get($value); $out .= $p->title; $out .= "yuppy, Ajax here!"; } } else{ $out .= "I am afraid, no ajax here"; } return $out; Do I miss something? thank you very much
  14. You're right - After some tests, I've move the code into execute() and now I see the message "Ajax post received" in Response. Now I better understand the function executeTesta() linking to another page (a page that doesn't even exist actually..), so I was likely trowing away the ajax submitted POST. Is the execute() the correct location for this code? thanks!