Jump to content

Zeka

Members
  • Posts

    1,065
  • Joined

  • Last visited

  • Days Won

    11

Everything posted by Zeka

  1. Hi @ngrmm $list = $pages->get(1234)->children; $toJSON = $list->explode(function ($item) { return [ 'title' => $item->title, 'id' => $item->id, 'tags' => [ 'ids' => $item->page_field->explode('id') ] ]; }); wireEncodeJSON($toJSON);
  2. Hi @lpa It depends on how many pages you have in the system. There is a 'rebuildAll' method in the PagesParents class that runs every time you move a page. Take a look at this issue https://github.com/processwire/processwire-issues/issues/1459 You can try to use transactions if you use InnoDB.
  3. Hi @modifiedcontent It's better to stick to this feature https://processwire.com/blog/posts/processwire-core-updates-2.5.14/#multiple-templates-or-parents-for-users
  4. I have had this issue since the site update, but have never been able to track what is causing it, it's definitely not only 'files'.
  5. Hi @Abe Cube I you are talking about ProcessPageEdit screen, that you can add runtime fields via hook. You can find some info there
  6. * - Inputfields.startSpinner(f): Start spinner for Inputfield. * - Inputfields.stopSpinner(f): Stop spinner for Inputfield.
  7. Hi @Chris Bennett It worth to mention that there is a branch of helpful public methods in Inputfields.js that you can use in such cases https://github.com/processwire/processwire/blob/master/wire/templates-admin/scripts/inputfields.js
  8. Hi @Frank Schneider Have you enabled urlSegments in template settings for mitglied_edit page?
  9. In this way it will generate an image variation and the original image will stay untouched, but as I understood @picaricawant to resize the original image. If so, you can do something like $this->addHookAfter('InputfieldImage::fileAdded', function(HookEvent $event) { $inputfield = $event->object; if ($inputfield->hasField != 'image' && $inputfield->hasField != 'images') return; $image = $event->argumentsByName("pagefile"); $maxSize = 780; $portrait = $image->height > $image->width; $property = $portrait ? 'height' : 'width'; $width = $portrait ? 0 : $maxSize; $height = $portrait ? $maxSize : 0; // if the current size exceeds the max, proceed a resize if ($image->$property >= $maxSize) { $is = new ImageSizer($image->filename, ['quality' => 100]); $done = $is->resize($width, $height); } });
  10. Hi @Juergen Try to set current user language to the langauge that are set for user to which you are sending mail like protected function sendActivationLinkEmail(User $user): bool { $savedLanguage = $this->wire('user')->language; $this->wire('user')->language = $user->language; // send an email with the activation link to the user // but check first if activation code (fl_activation) exists inside the database if($user->fl_activation){ $m = wireMail(); $m->to($user->email); $m->from($this->input_email); $m->subject($this->_('Action required to activate your account')); $m->body($this->createActivationLinkEmail($user)); $m->mailTemplate($this->input_emailTemplate); return $m->send(); } $this->wire('user')->language = $savedLanguage; return false; }
  11. Hi @Bike There is Textformatter type of modules that are applicable in such cases. You can take a look at this module https://github.com/Toutouwai/TextformatterProcessImages from @Robin S Probably it can suit your needs or at least you can use it as a staring point.
  12. Hi @rushy AFAK there is no built-in option. There is a way how you can override core modules https://processwire.com/blog/posts/processwire-core-updates-2.5.14/#multiple-copies-of-the-same-module. After that you can adopt 'getAdminThumb' method so your default image variation will match one that you are using on the frontend. Potentially there could be some issues with admin UI.
  13. Hi @picarica You can achive it by hooking InputfieldFile::fileAdded like in the example below: $this->wire()->addHookAfter('InputfieldFile::fileAdded', function ($event) { $inputfield = $event->object; if ($inputfield->hasField != 'image' && $inputfield->hasField != 'images') return; $image = $event->argumentsByName("pagefile"); // Main post image if ($inputfield->hasField == 'image' && $inputfield->hasPage && $inputfield->hasPage->template->name == 'post') { $image->size('postMainImageSmall'); $image->size('postMainImageMedium'); $image->size('postMainImageMediumPortrait'); $image->size('postMainImageLarge'); } // Matrix block 'Gallery' if ($inputfield->hasField == 'images' && $inputfield->hasPage && $inputfield->hasPage->repeater_matrix_type == 5 && $inputfield->hasPage->template->name == 'repeater_builder') { $image->size('postBlockGallerySmall'); $image->size('postBlockGalleryMedium'); $image->size('postBlockGalleryLarge'); $image->maxSize(config('imageSizes')['postBlockGalleryLarge']['width'], config('imageSizes')['postBlockGalleryLarge']['width']); } // Matrix block 'Slider' if ($inputfield->hasField == 'images' && $inputfield->hasPage && $inputfield->hasPage->repeater_matrix_type == 6 && $inputfield->hasPage->template->name == 'repeater_builder') { $image->size('postBlockGallerySmall'); $image->size('postBlockGalleryMedium'); $image->size('postBlockGalleryLarge'); $image->maxSize(config('imageSizes')['postBlockSliderLarge']['width'], config('imageSizes')['postBlockSliderLarge']['width']); } // Matrix block 'Image' if ($inputfield->hasField == 'image' && $inputfield->hasPage && $inputfield->hasPage->repeater_matrix_type == 7 && $inputfield->hasPage->template->name == 'repeater_builder') { $image->size('postBlockImageSmall'); $image->size('postBlockImageMedium'); $image->size('postBlockImageLarge'); $image->maxSize(config('imageSizes')['postBlockImageLarge']['width'], config('imageSizes')['postBlockImageLarge']['width']); } });
  14. Hi @Jan Romero Yes, I've solved it, but I don't remember what actually was causing this problem. What is your collation / encoding type? Have you tried to set $config->dbCharset = 'utf8mb4';
  15. @ryan Autosave is very usefull feaature, but in some sceanrios it would be great to have shortcut key (Ctrl+S) to force page save with saving of scroll positon. Maybe it's possible to implement it, while you are in thisfield?
  16. Several ways to do it: $page_to_clone = pages(1051); $destination_parent = pages(1016); $new_title = 'Example'; $pages->clone($page_to_clone, $destination_parent, false, [ 'set' => [ 'title' => $new_title, 'name' => '' ] ]); //////////////// wire()->addHookAfter('Pages::cloneReady', function ($event) { $pages = $event->object; $pagesNames = $pages->names(); $oldPage = $event->arguments(0); $newPage = $event->arguments(1); $sanitizer = $this->wire()->sanitizer; $newName = $sanitizer->pageNameTranslate($newPage->get('title')); $newPage->name = $pagesNames->uniquePageName($newName, $newPage->parent); }); //////////////// $page_to_clone = pages(1051); $destination_parent = pages(1016); $new_title = 'Example'; $pages->clone($page_to_clone, $destination_parent, false, [ 'set' => [ 'title' => $new_title, 'name' => $pages->names()->uniquePageName($sanitizer->pageNameTranslate($new_title), $destination_parent) ] ]);
  17. Hi @heldercervantes Why just not use Google Analytics for that? https://www.optimizesmart.com/tracking-site-search-get-based-search-engines-google-analytics/ https://www.lovesdata.com/blog/site-search-reports
  18. Zeka

    Wireframe

    @teppo Hi. It would be great to have a note about PageRenderNoCachePage session variable in the docs, it took me some time to understand the reason for the non-worked cache for some pages.
  19. https://github.com/artyuum/HtmlElement https://davidwalsh.name/create-html-elements-php-htmlelement-class
×
×
  • Create New...