Jump to content

simonsays

Members
  • Posts

    74
  • Joined

  • Last visited

Everything posted by simonsays

  1. 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.
  2. 3) Solved by pulling latest version. ckeditor website had old version
  3. 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.
  4. @ryan Any chance this module could be used for multilanguage textarea? It only appears as a text formatter for single language textarea.
  5. 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.
  6. Nope. Are repeater items created in a different way? Is there a good example?
  7. 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.
  8. 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?
  9. @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:
  10. @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!
  11. 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.
  12. wire()->addHookBefore('InputfieldFile::processInputAddFile', function($event) { print 1;exit; }); Tried to add hook to site/ready.php, but it is not working...
  13. 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?
  14. So, fieldgroups are only related to templates? And fieldgroup is only deleted when a template is deleted?
  15. Should also stay true for same entities. Therefore, having a page with some name should not mean, that I can't have a template with the same name.
  16. Hello, encountered weird error message, which in my opinion is wrong. I already have a PAGE named 'nav' using some template. I tried to create a new TEMPLATE for navigation (different purposes) also naming it 'nav'. When I try to do it via admin UI, I get "name already exists", when I use Migrations module I get ` Got error PDOException with SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'nav' for key 'name' ` The only culprit could be 'fieldgroups' table (which already has 'nav' name) with unique index. But is this an expected behaviour? User hardly manipulates field group names.
  17. Found quite a few bugs in modal.js, reported them under the same issue. Thanks for your help by the way! Your quick fix worked. @matjazp
  18. It's a clean install, so don't think that this is something local. The browser is Firefox. Asked my colleague to do clean install and test in Safari, also got an error (also Type error, but with a different stack). Also autoclose and ajax preloader problems on his computer. Jquery Core module is 1.8.3 and jquery itself is 1.11.1. Did not change anything after performing install.
  19. I have installed the latest version of processwire, but for some reason, the Page Frontend Editor is now throwing an error. <edit page="<?=$page->id?>" fields="title,body">test modal</edit> So every time I initialize modal window 1) Jquery error appears in console (see attached screenshot) 2) data-autoclose does not close the modal 3) The ajax preloader does not disappea when the modal is opened 4) When edited in modal, the fields are not updated without reloading the page (should they?) I am pretty sure this comes from processwire itself rather than the module. Has anyone come across this? Has anyone reported it? Where should I report it, if not?
  20. For now I've added location reload to function modalInitEditableRegions() { var regions = $('.pw-edit-modal'); if (!regions.length) return; $(document).on('pw-modal-closed', function (e, eventData) { if (eventData.abort) return; // modal.js populates 'abort' if "x" button was clicked var target = $(e.target); if (!target.is('.pw-edit-modal')) return; var targetID = target.attr('id'); var viewURL = $('#pw-url').val(); viewURL += (viewURL.indexOf('?') > -1 ? '&' : '?') + 'pw_edit_fields=' + target.attr('data-fields'); setBusy(true); target.load(viewURL + ' #' + targetID, {}, function () { var t = $(this); var children = t.children(); if (children.length) { var html = t.children().html(); t.html(html); } t.trigger('pw-reloaded'); setBusy(false); location.reload(); }); }); } but is there a good way to reload on actual save?
  21. Hello! Thanks for the awesome front-end editor! Real difference maker when it comes to picking CMS. However, there is one tiny drawback, which the client has brought up. When I am editing multiple fields in a modal, it would be awesome that on save it would close and also reload the page (so I could actually see the changes). However, simply reloading location when the form is saved like that // click action to save edits $('.pw-edit-save').click(function () { $('.pw-editing:not(.pw-edit-InputfieldCKEditor)').blur(); setTimeout(function () { inlineSaveClickEvent(); }, 250); location.reload(); }); not only leaves the modal open, but also does not update the fields initially. Any advice?
  22. Is this thread still alive? Has something changed so far, so that repeater fields could be added in a more elegant way (I mean, when added programmatically)? ?
×
×
  • Create New...