Jump to content

gingebaker

Members
  • Content Count

    27
  • Joined

  • Last visited

Community Reputation

34 Excellent

About gingebaker

  • Rank
    Jr. Member

Recent Profile Visitors

2,027 profile views
  1. Hi There is also an open issue for this problem on github with some possible fixes. https://github.com/processwire/processwire-issues/issues/704
  2. Hi Ryan Just added a fix for this in 3.0.112. See the Issue here on github: https://github.com/processwire/processwire-issues/issues/675#issuecomment-420958397 I also added my final hook in the comments. regards, tom
  3. Hello OLSA Just tried your temporarily solution. Works perfect, Didn´t know that I can replace core modules so easy! Thanks for the hint! regards,
  4. Hello Robin Thanks for the reply. I just opened an Issue: https://github.com/processwire/processwire-issues/issues/675 I mentioned your request there and als gave him a thumbs up!
  5. Hello I am having an issue with hooking the SearchBox in the Admin Interface in PW >= 3.0.108 where the new Search Features are added. I hooked: $this->addHookAfter('ProcessPageSearch::executeFor',$this,'executeFor'); to change the title format of specific pages in the SearchBox of the Admin. This looked something like this: public function executeFor($event) { $return = json_decode($event->return); if($this->input->get->admin_search) { $return = json_decode($event->return); if(isset($return->matches)) { $didChange = false; foreach($return->matches as $key => $match) { if($match->template == "templateX" || $match->template == "templateY") { // add vorname and nachname to title $matchPage = $this->pages->get($match->id); $return->matches[$key]->title = $match->title.' - '.$matchPage->get('nachname').' '.$matchPage->get('vorname'); $didChange = true; } } if($didChange) { $event->return = json_encode($return); } } } } The reason I am doing this is that on some special templates I don´t want to show only the title field of this template in the Search Autocomplete but show some other fields to get a better usability. Now with the new ProcessPageSearchLive.php Module it seems that this is not possible anymore? There are the two hookable functions ___renderList and ___renderItem, but the are only called by viewAll Output. So the code where I should hook into is somewhere in the findPages() function of ProcessPageSearchLive.php, but I could not find a way to Hook into and modify it? https://github.com/processwire/processwire/blob/dev/wire/modules/Process/ProcessPageSearch/ProcessPageSearchLive.php#L736 Is there a way to get this done as it was with the old search? Perhaps i am overseeing something? Thanks for any help!
  6. @Robin S , thanks for your reply. I just filled a request for that: https://github.com/processwire/processwire-requests/issues/84
  7. Hello. Just wanted to ask if there if there is a way to NOT delete Repeater (or Matrix) Items directly but move them to the Standard Trash if the Trash-Icon on the Edit Screen is clicked? This would be helpful when editors accidently delete some Repeater-Items. There is also no Confirm Message when deleting. Especially in Repeater matrix Items there can be a whole lotta Content wich is gone forever. Thanks for every Info...
  8. Hi. I also needed a solution for Images Pagination and came up with this solution. It only works on PW 3 with the new PaginatedArray class. My Situation: I have a image field with about 150 images. I want to output these Images with a PagerNav. The same i use on $pages->find(). This is the function wich I wrote to get this working for PageImages. /** * Renders a pagination based on files using the PaginatedArray Class. Overrides the input parameter $files with the sliced result * and returns the rendered pagination. * @param $files ... the full Pageimages WireArray * @param int $perPage ... items per Page * @param $pagerOptions ... standard Pager Options as used in MarkupPagerNav.module * @return string ... rendered pagination */ public function renderFilePagination(&$files,$perPage=10,$pagerOptions) { $total = count($files); if($total <= $perPage) return ''; $pagerArray = new PaginatedArray(); $pagerArray->setLimit($perPage); $pagerArray->setTotal($total); $pagerArray->setStart(($this->input->pageNum - 1) * $perPage); $pagerArray->import($files->slice($pagerArray->getStart(), $pagerArray->getLimit())); $files = $pagerArray; // overwrite $files $ret = '<div class="paginationInfo uk-text-center uk-text-small uk-margin-top">'.$pagerArray->getPaginationString().'</div>'; $ret .= $this->modules->MarkupPagerNav->render($pagerArray,$pagerOptions); return $ret; } This function has to be available in your template files. Perhaps you need to remove the public. I am using it in in a custom module. Now in your template file you have your images field for ex.: $page->images (multiple Images). You can call the function like this: $pagination = $modules->KaTemplateHelper->renderFilePagination($page->images,$perPage=40,array( 'listMarkup' => '<ul class="uk-pagination">{out}</ul>', 'itemMarkup' => "\n\t<li class=\"{class}\">{out}</li>", 'linkMarkup' => '<a href="{url}"><span>{out}</span></a>', 'currentLinkMarkup' => '<span>{out}</span>', 'currentItemClass' => 'uk-active', 'nextItemLabel' => '»', 'previousItemLabel' => '«' )); The third array parameter is completely optional. I only use it for changing the standard page nav markup. If you use the standard markup then call: $pagination = $modules->KaTemplateHelper->renderFilePagination($page->images,40); ----------------------- After the call: $page->images only contains the subset wich will be display on this page. $pagination contains the rendered HTML Markup for $pagination. Perhaps this helps someone. I know this is not fully flexible implemented, but this is only a snipped for me that I change as i need it.
  9. Hi. First of all, thanks for this great module! I do have one question: Is there a reason why this module is not "singular"? To be clearer: adding ""singular": true" to the jsonfile. I am having the automatic send option enabled, and use some custom api code to add new users in frontend-scope and backend. According to the json info file the module gets autoloaded on "template=admin". So in Frontend I have to use $this->modules->get("EmailNewUserPortal"); Because my custom code gets executed in frontend and admin, I would have to check where I am, because if I do $this->modules->get("EmailNewUserPortal"); in backend there are two instances of the module running. This results in sending the NewUser Mail twice. After adding the singular Option to your module, this issue has gone. Perhaps there is another need to be not singular here wich I didn´t see? Just wanted to ask... Thanks...
  10. Another solution would be to hook to Inputfield::processInput and change the Input-Data to a full datestring that can be converted from php´s strtotime function. (for example YYYY-mm-dd). (I guess the Datepicker on focus option should be disabled) Here is what I am using in my custom module for DateTime Fields named "date" and "date_to": in init function $this->addHookAfter('Inputfield::processInput', $this, 'processInputDate'); the function public function processInputDate($event) { $inputfield = $event->object; $input = $event->arguments[0]; if($inputfield->name == "date" || $inputfield->name == "date_to") { if(isset($input[$inputfield->name])) { $value = $inputfield->value; if($value && ctype_digit($value) && strlen($value) == 4) { // seems to be only a year, so add 01-01 to it. $value = $this->sanitizer->int($value); $newValue = '01-01-'.$value; $inputfield->setAttribute('value',$newValue); $this->message("Converted ".$value." to a full date string: ".$newValue.")"); } } } } However, I think this makes only sense in certain cases. I need the possibilty to enter also a full date. In my case its okay that the 01. January is some kind of a "special day", where all the items are going wich have only a "year" but no month/day.
  11. As soon as I make the Inputfield::renderReady function hookable in core, I can add the scripts and styles for my rendering there and it also works in ajax loaded fields or repeaters. @ryan: Is there a change to make this renderReady hookable in core? thx for any information... Tom
  12. Hi Just wanted to ask again. Perhaps I didn´t describe it that good. So the short version: Is there an Javascript Event that is triggered when the rendering of the Page List ( ProcessPageList ) is really completed? Thanks very much... Tom
  13. Hi all... I would like to add some special javascripts files to a Inputfield if certain conditions are fullfilled. Thats working good with hook Inputfield::___render when the field is directly loaded on ProcessPageEdit. However I have problems adding these scripts when the Inputfield is not loaded directly on pageLoad. In my case a dynamically loaded repeaterItem. I found the Inputfield::renderReady method wich seems to be the best place, but it´s not hookable? ( https://github.com/processwire/processwire/blob/master/wire/core/Inputfield.php#L1030 ) ( the call in Repeater: https://github.com/processwire/processwire/blob/master/wire/modules/Fieldtype/FieldtypeRepeater/InputfieldRepeater.module#L204 ) Is there an "official" way of doing that? Of course I could hook in somewhere else, but that renderReady would be the place to go or am i wrong? Thanks for any information... Tom
  14. Hi I wanted to extend the standard backend ProcessPageList with some custom Javascript Addons. Lets say Tooltips on some child pages list. The problem is that I could not find any JS-Event that wire/modules/Process/ProcessPageList/ProcessPageList.js fires wich I could use for that. This Event has to be fired when the whole PageList is rendered, or when a new Part via Ajax is rendered. There is an loaded() function in this Script ( https://github.com/ryancramerdesign/ProcessWire/blob/devns/wire/modules/Process/ProcessPageList/ProcessPageList.js#L306 ), but as far as I know there is now way I can "hook" into that function? Or am I wrong? Does anyone if this would be possible now? If not? Perhaps it would be possible that PageList also triggers an Javascript Event when the List is completely rendered (from ajax or the openPageData JSON in HTML)? Similar the way that Repeaters do... $inputfields.find('.Inputfield').trigger('reloaded', ['InputfieldRepeaterItemEdit']); You could then use somethink like that (taken from InputfieldPage): $(document).on("reloaded", ".InputfieldPage", function() { initInputfieldPage($(this)); }); Thanks for any information... gingebaker
×
×
  • Create New...