Viewing 13 replies - 1 through 13 (of 13 total)
  • eaglejohn

    (@danielbenjamins)

    Is there any chance this bug will be fixed soon? This plugin looks promising.

    Thread Starter Willy Bahuaud

    (@willybahuaud)

    Plugin Author BIOSTALL

    (@biostall)

    Thanks Willy. I’ve taken your solution and added it to the plugin (have given you credit in the changelog).

    This only works for version 5 of ACF at the moment. It’s proving very difficult to get the JavaScript to execute in a repeater field for v4 and will address this another time.

    Any word on solving this for v4? Or a point in the right direction for a fix?

    This doesn’t seem fixed for me (v5): If I create a link picker inside a repeater on an options page, the link picker does not work. The page just refreshes, if you’re quick you can see the error is “wpLink is not defined”.

    Thread Starter Willy Bahuaud

    (@willybahuaud)

    Rubious,

    Do you have an editor on this admin page ? or juste ACF fields…

    Just ACF fields, in fact just the 1 field. See screenshot: https://files.app.net/w22wg9gpT.png

    Thread Starter Willy Bahuaud

    (@willybahuaud)

    Ok,

    I think the plugin should also enqueue this scripts and styles before using wpLink script in input.js :

    • wp_enqueue_script(‘wplink’);
    • wp_enqueue_script(‘wpdialogs-popup’);
    • wp_enqueue_style(‘wp-jquery-ui-dialog’);
    • wp_enqueue_style(‘thickbox’);

    Could you try pasting these lines into acf-link_picker-v5.php, line 185 ?

    Thnx

    I tried that, there is still an error (although a different one).

    Cannot read property ‘select’ of undefined

    Thread Starter Willy Bahuaud

    (@willybahuaud)

    In your console, can you find which file causes this error ?

    Hi Willy,

    It’s load-scripts.php – the line that is your script (starts var wpLink;!function(a) …)

    tenkinetic

    (@tenkinetic)

    This is a couple of months old, and resolved, but I was also trying to sort out the “Cannot read property ‘select’ of undefined’ issue in the /wp-includes/js/wplink.js script (which is the one that load-scripts.php is handling in this case).

    What wplink.js is not finding are the HTML elements that are rendered along with a tinymce editor. I had assumed that the enqueue scripts mentioned above would do this.

    In my case, I wanted to use the link editor in a widget that belongs to a plugin. There is no editor rendered on this page so I got the same error as rubious.

    My widget happened to need an editor I just hadn’t gotten to dealing with that yet and it was still just a text input. After putting one in (with wp_editor(”, ‘unique_id’, array(‘editor_class’=>’hidden’));). Everything worked.

    Why the hidden class? In the end I decided I didn’t want an editor, just a textarea for my widget. So I rendered the editor (not in the Widget anymore but just once for the whole admin page) hidden because I still wanted the HTML for the link editor to be rendered. I then had to hide the HTML element with the id ‘wp-unique_id-wrap’ (the same unique_id as in wp_editor) because the class in wp_editor only applies to the input field in the editor not the controls etc surrounding it (making the array argument for wp_editor redundant really).

    So… if anyone is having this issue try ensuring an editor is present on your page. I’ve no idea why enqueueing the scripts didn’t do it but hey. It probably just includes the wplink.js javascript. Who knows, everyone else might be doing this in pages that happen to have an editor.

    Do not be tempted to manually place the link editors’ HTML in your page in an effort to avoid having a whole editor. Just… don’t.

    Pull request created to handle v4 repeaters.

    https://github.com/BIOSTALL/ACF-Link-Picker-Field/pull/12

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Solve incompatibility with repeater fields’ is closed to new replies.