simonsays

Starter
  • Content Count

    48
  • Joined

  • Last visited

Community Reputation

1 Neutral

About simonsays

  • Rank
    Jr. Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. simonsays

    Hello, I am using two VPSs for a website and would like to have persistent admin login for both. E.g. when someone logs into admin on one server, he's automatically logged in on the second one. Both webservers are under the same domain (there is Varnish LoadBalancer on top, so it either fetches one version or another one). Is it possible to sync sessions in processwire? I have installed SessionHandlerDB module, but it does not seem to create any cookie (only session) on admin login. Is there a good module for that? Or should I add a login hook instead?
  2. simonsays

    This plugin is not so good as it sets embed properties globally (for our project they vary from page to page). I managed to get ACF working by slighly modifying your input to div(*)[*]{*} iframe(*)[*]{*} Guess, still own you a small one. This solves 2) with ACF. Still confused about 1) (HTML purifier).
  3. simonsays

    Adding iframe to EAC the way you suggested solved the problem partially. the dialog is correct, but for some reason it has "class" attribute missing for edit.
  4. simonsays

    3) Solved by pulling latest version. ckeditor website had old version
  5. simonsays

    Hi, anyone had experience with installing and using this plugin for CKEditor in PW. My PW version is 3.0.97 https://ckeditor.com/cke4/addon/youtube 1) Problem 1. Inserted iframes were stripped from the editor. I managed to avoid this by disabling HTML purifier. Is there a more elegant way to solve this? 2) Problem 2. When clicking on inserted iframe, it would open default dialog with limited iframe properties instead of extended one provided by the plugin. Solved this by disabling ACF. Any way to solve this without disabling it? 3) Problem 3. Most annoying, can't solve. I have added setting ` config.youtube_responsive = true; ` to InputfieldCKEditor/config.js, yet it is still not responsive and does not change anything in the UI. P.S. I tried using TextformatterVideo module but it is not good, since it only has global settings while in my case we need to have individual video embed settings for every page.
  6. @ryan Any chance this module could be used for multilanguage textarea? It only appears as a text formatter for single language textarea.
  7. simonsays

    Sorry, @adrian will get back to you asap. Rather busy with current sprint Just tested. Without explicitly going through all the repeaters prior to save and setting their formatting to false, I got exactly the same result.
  8. simonsays

    Nope. Are repeater items created in a different way? Is there a good example?
  9. simonsays

    Yes, the output format was the problem, but I still run it inside a module, but had to explicitly loop through Repeater fields and set output formatting to false. Curious why it does not do by default, when I set the page formatting to false.
  10. Hello everyone, I am stuck and would really appreciate some assistance. I am trying to write a recursive method which populates newly created pages with default dummy data. /** * Set dummy data to page fields * * @param type $page * @return $this */ protected function setDummyData(&$page) { $language = $this->user->language; $this->user->language = $this->wire('languages')->get('default'); $dummyDataType = $this->getDefaultDummyData(); $page->of(false); foreach ($page->template->fields AS $field) { $type = (string) $field->type; if (isset($dummyDataType[$type])) { $value = sprintf($dummyDataType[$type], strtolower($field->label)); $page->{$field->name} = $value; } elseif ($field->type instanceof FieldtypeOptions) { $page->{$field->name} = $field->defaultValue; } elseif ($field->type instanceof FieldtypeRepeater) { $page->save(); foreach ($page->{$field->name} as &$repeater) { $this->setDummyData($repeater); } } } $page->save(); $this->user->language = $language; return $this; } /** * Fetch default dummy data by type * * return array */ protected function getDefaultDummyData() { $dummyDataType = [ 'FieldtypeTextareaLanguage' => 'Start writing your <b>%s</b> here...<br/>Make sure text is input before you publish...', 'FieldtypeImage' => $this->wire('config')->paths->root . 'site/migrations/dummy/default.png', ]; return $dummyDataType; } Today I tried extending it to work with repeater fields and simply nothing happens. It detects the $field->type as Repeater, but when I try to loop through all repeaters within this field, it shows its count as 0. Anyone has an idea on what might be wrong? Should repeater item be initialized in a different way?
  11. simonsays

    @adrian Sorry about the line number confusion, I did insert two debugging lines when trying to reproduce/debug (I use the latest module version). And yes, it is PHP 7.2. Should have mentioned as well. There are actually two workarounds for my problem - either mark output format as an array in admin (a quick fix) or set repeater outputFormatting to false before saving the page (more bullet proof). This helps me for now, but I am still curious, why this does not happen when I use PW admin. As if outputFormatting for the repeater (not for the page itself) is explicitly set to false elsewhere Here are my settings:
  12. simonsays

    @adrian Hello Adrian, I am using your module and completely clueless about one thing. Your code has this place elseif($field->type instanceof FieldtypeRepeater) { foreach($editedPage->{$field->name} as $repeater) { //make sure repeater item actually exists already, which is important when you have added items beyond those initially rendered. //fixes this issue: https://github.com/ryancramerdesign/ProcessWire/issues/1541 if(!$repeater->id) continue; foreach($repeater->fields as $rf) { if($rf->type instanceof FieldtypeFile) { if(count($repeater->{$rf->name})) { foreach($repeater->{$rf->name} as $file) { if(!$file) continue; $files[$file->name] = $repeater->id.'|'.$rf->id; // add filename with respective repeater pageid and fieldid to array } } } } } } } However, when I save a page which has a repeater with empty single image, I got a notice <b>Warning</b>: count(): Parameter must be an array or an object that implements Countable in <b>C:\t2cms\site\assets\cache\FileCompiler\site\modules\ProcessCustomUploadNames\ProcessCustomUploadNames.module</b> on line <b>204</b><br /> The reason is that image is empty and is NULL. I tried to debug your module using PW admin, namely by moving the same page and checking the output. And surprise, there was no notice... Instead of NULL, empty Pagefields object had been passed. Is there a hook in PW or your module which returns empty Pagefields array instead of NULL for single empty image. For me the issue is only reproducable for image inside a Repeater. Thanks in advance!
  13. My page has a repeater field with several fields as well as an image. In my module I tried to output all page fields. $page->of(false); foreach($page->fields as $field) { if ($field->type instanceof FieldtypeRepeater) { foreach($page->{$field->name} as $repeater) { foreach($repeater->fields as $rf) { print $rf->name . ': '; var_dump($repeater->{$rf->name}); } } } } I got the following output: title: string(0) "" colors: object(ProcessWire\SelectableOptionArray)#497 (2) { ["count"]=> int(1) ["items"]=> array(1) { [1]=> int(1) } } content: string(0) "" component_position: object(ProcessWire\SelectableOptionArray)#501 (2) { ["count"]=> int(1) ["items"]=> array(1) { [1]=> int(1) } } image: NULL link_title: string(0) "" link_url: bool(false) However, shouldn't empty image field return object(ProcessWire\Pageimages)#501 (1) { ["count"]=> int(0) } ??? For example, when I use Custom Upload Names module it has these lines elseif($field->type instanceof FieldtypeRepeater) { foreach($editedPage->{$field->name} as $repeater) { //make sure repeater item actually exists already, which is important when you have added items beyond those initially rendered. //fixes this issue: https://github.com/ryancramerdesign/ProcessWire/issues/1541 if(!$repeater->id) continue; foreach($repeater->fields as $rf) { if($rf->type instanceof FieldtypeFile) { if(count($repeater->{$rf->name})) { foreach($repeater->{$rf->name} as $file) { if(!$file) continue; $files[$file->name] = $repeater->id.'|'.$rf->id; // add filename with respective repeater pageid and fieldid to array } } } } } } } and they output Pageimages (tried debugging by moving pages in admin), even if there is no image. My Processwire version is 3.0.97.
  14. simonsays

    wire()->addHookBefore('InputfieldFile::processInputAddFile', function($event) { print 1;exit; }); Tried to add hook to site/ready.php, but it is not working...
  15. Hello, I am using shared VPS and have access to htaccess. I increased filesize limit to php_value upload_max_filesize 100M php_value post_max_size 100M However, I bump into running out of memory error when uploading really large file. I am really not excited about increasing memory limit in the .htaccess settings, I'd rather make it conditional and increase it (or use -1) runtime, when admin uploads something. What would be the best way/place to do it?