-
Posts
1,065 -
Joined
-
Last visited
-
Days Won
11
Everything posted by Zeka
-
$this->addHookAfter('ProcessPageListActions::getActions', function($event) { $actions = $event->return; $actions['view']['name'] = 'SomeValue'; $event->return = $actions; });
-
Replace the original image with a resized variation of itself.
Zeka replied to Zeka's topic in General Support
Hi @horst Thanks for the code; I have found that there is 'saveFileCols' method that can be used to set values of these properties in DB. $fieldtype = $fields->get('image')->getFieldtype(); $image = $page->get('image'); $fieldtype->saveFileCols($page, $fields->get('image'), $image, [ 'width' => $image->width, 'height' => $image->height, 'ratio' => $image->ratio, 'filesize' => $image->filesize ]); -
Hi @abmcr I think you can try to use wireLangReplacements https://processwire.com/blog/posts/pw-3.0.155/#new-wirelangreplacements-function
-
Hi @gebeer Not sure that this issue is PW relative. Take a look at this thead on apple discussions: https://discussions.apple.com/thread/252479616
-
Also you can use owner selector like template=tag, tags.owner.template=post, limit=10 Where 'tags' is your page reference field used in blog post template and 'post' is the name of this template.
-
[SOLVED] Field template output removed from final template output?
Zeka replied to BrendonKoz's topic in General Support
Hi @BrendonKoz I have never used markup regions, so no help here, but I see that you use Processwire instead of ProcessWire namespace and there is debug section in the docs, so maybe it could help to find what is going on https://processwire.com/docs/front-end/output/markup-regions/#debugging-regions -
Hi @rushy You can use WireCache for it https://processwire.com/api/ref/wire-cache/
-
module gets auto-installed if called from front-end?
Zeka replied to applab's topic in Module/Plugin Development
Hi @applab Probably somewhre in your code you are calling $modules->get("MyModule"). So just check before getting this module. if ($modules->isInstalled("MyModule")) { echo $modules->get("MyModule")->renderBlock(); } Also if this module is required by another module it will be installed (Not sure, but looks like it behaves in this way). -
Also worth to mention 'owner' selector https://processwire.com/blog/posts/processwire-3.0.95-core-updates/
-
[Solved] Dynamically populate a field on another page
Zeka replied to gregory's topic in General Support
Hi @gregory. Session or cookies.- 1 reply
-
- 2
-
Hi @manlio Have you seen this module? https://github.com/teppokoivula/ProcessLoginHistory Also you can use Google Analytics for tracking logged in users https://phppot.com/php/track-individual-logged-in-users-using-google-analytics/
-
Hi @Crowdland Technology There has been a lot of changes in 3.0.185 that relative to ML support and other part of request handling so it's better to stay for some time on the stable 3.0.184. There is already an opened issue https://github.com/processwire/processwire-issues/issues/1447 So you can describe your case there
-
// requeire https://processwire.com/modules/file-validator-svg-sanitizer/ and $svgSanitizer = $this->wire()->modules->get('FileValidatorSvgSanitizer')->getSvgSanitizer(); $svgSanitizer->minify(true); $svgSanitizer->removeXMLTag(true); $data->setArray([ 'inline_svg' => $svgSanitizer->sanitize($this->wire()->files->fileGetContents($category->get('svg')->filename)), ]);
-
Hi @ryan Thank you for the updates and new module. I have used $session a lot in custom modules in the admin area, but not so much on the frontend (except areas where logged-in users could interact with site and basic $session redirects); I just checked the 'assets/sessions' folder which contains 115711 files (462.92 Mb) on one of the sites that have 50k visitors per day and I think that I would benefit if I disallow session for the guest visitors on the fronted, but I'm not sure about what I should consider in this case. Will $session->redirect etc work?
-
Hi @sebr As for the first point. You can copy LanguageTabs module to the site/modules folder and adopt for you needs. As for the second point. There is no ready to use solutions but it doable by hooks. I've been working on the two module. One that allows to disable default language and the second one that add reuquirement for non default langauges of multilangauge fields and check if they are filled. They are site specific but you can use them as starting point and try to addot for your needs.
-
Hi. You can try to use $page->if() https://processwire.com/api/ref/page/if/ if($page->if('image')) { // ... } $page->if('image', function($image) { // ... })
-
Hi. I've never used this feature by from this thread I can assume that it meens that user has page-view permission for the corresponding template.
- 1 reply
-
- 1
-
@fbg13 The link is dead, where I can download your module? @eelkenet maybe you have an copy?
-
Hi. https://github.com/processwire/processwire/blob/master/wire/core/Templates.php#L303 So it looks like cloning of the template doesn't clone fields context for template fieldgroup. You can do it by api like $sourceFieldgroup = $fieldgroups->get('service'); $newFieldgroup = $fieldgroups->get('test'); foreach ($sourceFieldgroup as $field) { if($sourceFieldgroup->hasFieldContext($field) && $newFieldgroup->hasField($field)) { $contextArray = $sourceFieldgroup->getFieldContextArray($field->id); $newFieldgroup->setFieldContextArray($field->id, $contextArray); } } $newFieldgroup->saveContext(); Probably there is better way but it worked for my case.
- 1 reply
-
- 4
-
Hi @millipedia. Nice write-up. How did you get forcing of PDF downloading? Recently I was working on the project where they had a large amount of science articles in PDFs and they wanted to force downloading of these files with settings custom file names (user provided). There is the code that I use, but for some reason some of PDFs files still open 'inline' in Chrome. $wire->addHook('/download/{pageid}/{basename}/', function ($event) { $page = $this->wire()->pages->get($event->pageid); if ($page->id) { $file = $page->filesManager->getFile($event->basename); $filename = $file->description ? $file->description . '.' . $file->ext : $file->basename; wireSendFile($file->filename, [ 'downloadFilename' => $filename, 'forceDownload' => true, 'exit' => true, ]); } else { wire404(); } });
-
There some usefull examples if you are in ML setup