Bug Fix: Unable to edit a block with SmartLink in it, if the SmartLink is empty and not logged in as Admin
Permalink Browser Info Environment
If you use the 'Smart Link', it creates a snippet of JavaScript to fetch page info based on a data-cID attribute on the Page Selector element.
If you do not select a page (or image/file etc.) the 'page' field is given a default value of '0' instead of ''.
When not logged in as 'admin', but logged in as another 'Administrator' user you cannot access page '0' so it throws an error when you try to go in and edit it again as it cannot access the page.
There is an oversight in the JavaScript which does not fall back to a blank string when the value is '0' (like it does for files and images). To fix, change line 59 in auto.js for the created block to:
If you do not select a page (or image/file etc.) the 'page' field is given a default value of '0' instead of ''.
When not logged in as 'admin', but logged in as another 'Administrator' user you cannot access page '0' so it throws an error when you try to go in and edit it again as it cannot access the page.
There is an oversight in the JavaScript which does not fall back to a blank string when the value is '0' (like it does for files and images). To fix, change line 59 in auto.js for the created block to:
'cID': $(ftSmartLinkPage).attr('data-cID') != '0' ? $(ftSmartLinkPage).attr('data-cID') : ''
Type: | Discussion |
---|---|
Status: | Resolved |
Hm, ok, are you looking when it is inside a repeatable? Thats where we see it.
Also, the db.xml will need to send a default of 0 in this case too:
Currently is does not give a default.
The json is as follows:
Looks like a fairly older version of 2.5 not 2.8.3. Will try an updated version :)
Also, the db.xml will need to send a default of 0 in this case too:
<field name="link_Page" type="I"> <default value="0"></default> <unsigned></unsigned> </field>
Currently is does not give a default.
The json is as follows:
{"view_css":"","view_js":"","block_name":"Basic Content repeater","block_description":"A block which creates multiple WYSIWYG content items","block_type_set":0,"cache_block_output_lifetime":"","block_install":1,"ignore_page_theme_grid_framework_container":0,"cache_block_record":0,"cache_block_output":0,"cache_block_output_on_post":0,"cache_block_output_for_registered_users":0,"table_prefix":"","interface_width":"400","interface_height":"500","fields":{"1":{"type":"text_box","label":"Block title","slug":"blocktitle","description":"Optional title for the whole block","prefix":"","suffix":"","max_length":"","placeholder":"","fallback_value":"","repeatable":""},"7":{"type":"wysiwyg","label":"Block Intro","slug":"blockintro","description":"","prefix":"","suffix":"","repeatable":""},"2":{"type":"image","label":"Block image","slug":"blockimage","description":"Optional image for the whole block","prefix":"","suffix":"","class":"","link":"","link_class":"","width":"","height":"","repeatable":""},"3":{"type":"repeatable","label":"Repeatable","slug":"repeatable","required":"1","description":"The collection of WYSIWYG items","prefix":"","suffix":"","child_prefix":"","child_suffix":"","title_me":"","min_length":"","max_length":"","add_entry_text":""},"4":{"type":"text_box","label":"Title","slug":"title","description":"Optional title for the WYSIWYG item","prefix":"","suffix":"","max_length":"","placeholder":"","fallback_value":"","repeatable":"3"},"6":{"type":"image","label":"Image","slug":"image","description":"Optional image for the WYSIWYG item","prefix":"","suffix":"","class":"","link":"","link_class":"","width":"","height":"","repeatable":"3"},"5":{"type":"wysiwyg","label":"Content","slug":"content","description":"The WYSIWYG content for the WYSIWYG item","prefix":"","suffix":"","repeatable":"3"},"9":{"type":"smart_link","label":"Link","slug":"link","description":"","prefix":"","suffix":"","file_download":"1","class":"","repeatable":"3"},"10":{"type":"text_box","label":"Classes","slug":"classes","description":"","prefix":"","suffix":"","max_length":"","placeholder":"","fallback_value":"","repeatable":"3"}},"block_handle":"basic_content_repeater","packages":{"block_designer":{"version":"2.5.3"},"block_designer_pro":{"version":"2.5.0"}}}
Looks like a fairly older version of 2.5 not 2.8.3. Will try an updated version :)
Hi there,
Update both version of Block Designer and Block Designer Pro first and see if that fixes it.
Kind regards,
Ramon
Update both version of Block Designer and Block Designer Pro first and see if that fixes it.
Kind regards,
Ramon
The current code it generates is this:
I do not see the issue here, seems like it's the code you provided already (in the end). You are on the latest version of Block Designer Pro?
Perhaps you can send me your config.json file too.
Kind regards,
Ramon