Jump to content

Issue with PWimage in CKEditor in PW 3.0.184


Alkrav
 Share

Recommended Posts

Hi Everybody.
I have the issue with image button in CKEditor (PWimage plugin) after upgrade from PW 3.0.165 to PW 3.0.184.
When i click in image button in CKEditor in the repeated field is open modal window with strange information and proposition to choose the page for use images. Like on the screenshot.
With the text: There are no image fields on this page. Choose another page to select images from.

But when i click the same button in CKeditor but in the ordinary textarea (not repeated) field it works fine and opens modal window with images linked with this page


Is anybody know about this issue solution? Thanx.

 

pwimage-edited.png

Edited by Alkrav
change image
Link to comment
Share on other sites

hi,

actually this could be seen as a more strict pw way of thinking pages...
each item of a repeater is a page by itself, that's what allows you to use the same fields many time in a "parent" page

so far, pw repeater items ckeditor went browsing its parent page images but imagine you had an image field in the repeater item, the problem would be the same but inverse
i know we can tell a ckeditor field which field to go looking for images but, in a repeater, you would have as many of this image field with the same name as you have repeater items and, have a look at the item name, a little harder to find it in a list of pages than the parent page the repeater is in

i think this is the reason for this little change of behaviour

have a nice day

Link to comment
Share on other sites

This was indeed an intentional change in the core.

@ryan explained it earlier elsewhere, and provided following snippet (which should be placed in /site/templates/admin.php) for cases where this behaviour is unwanted:

if($page->process == 'ProcessPageEditImageSelect') { 
  $editorPageId = (int) $input->get('edit_page_id');
  $imagesPageId = (int) $input->get('id');
  if($editorPageId && $imagesPageId && $editorPageId != $imagesPageId) {
    $imagesPage = $pages->get($imagesPageId);
    if($imagesPage instanceof RepeaterPage) { 
      $input->get->id = $editorPageId;
    }
  }     
}

While I get the reasoning (you're editing a Repeater Page, and thus it's logical for images to also be loaded from that same Repeater Page — plus there may be cases where an image gets unintentionally deleted since it's not used in any CKEditor field(s)), I've got a similar hook in place on all of our new sites, since I also find the previous behaviour preferable.

Basically it restores pre-3.0.184 behaviour ?

  • Like 2
Link to comment
Share on other sites

Hi @teppo

thanks a lot for your insight, i was assuming something like that as it sounds very logical according to the pw "everything is a page" concept and us crazy devs are quite found of logics ?

but thank you very much for the hook, it may help for clients who would be confused after a pw update and i'm sure @Alkrav will love it too ?

have a nice day

  • Like 1
Link to comment
Share on other sites

Hi, @virtualgadjo!
Thank you for trying interpretation of the system logic, and i understand and support it.
But even early user can choose the images from any pages by clicking on the top with path on PWimage's modal window.
But the interface of choosing pages without searching ability isn't comfortable for me.
I think it needs rework design of PWimage view and add search line there and to the childs of page on dashboard.

Anyway Thank you.

Link to comment
Share on other sites

Hi @Alkrav
my pleasure and, wow, good idea a little search field when dealing with website with a lot of pages

in my case i have three situations that help me not be lost in the matrix ?
- when it comes to complex repeater in which i know i'll use many images, i put an image field in each repeater item (as they are pages, it works like a charm)
- in the case you describe, the image field in the "parent page", well, not too long to select but here i admit i won't deny the use of a search field for big website or, simple way to prioritize this "parent" in the list page
- when it comes to images i know i'm going to use in many pages i usually have a "stock page", hidden from the front side and the sitemap, in which i put some fields, default translations (with Ryan functional fields module), some default fields i'll use in many pages and... an image field
i often give this page a loooong title that make it easy to find in the list ?

but i like your search field idea, you should suggest it in the wishlist forum! Ryan may like that too ?

have a nice day

  • Like 1
Link to comment
Share on other sites

4 hours ago, Alkrav said:

I had searching for any infos about it on the forum, but didn't.
May be i inserted the wrong interpretaion of issue.
Where i can read @ryan's notice of it?

This was in the support area for Repeater Matrix, so not on the public forum.

  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...