-
AuthorPosts
-
August 14, 2017 at 10:19 am #838507
Hello,
I found a nice and upgrade-safe way to acivate/deactivate single elements in the builder.
This can be extended to ACL control or timed content without problems.
I added a new attribute “disabled” to the elements globally and I also want to have a visual hint in the builder UI, to show that the element is disabled.
But,I don’t find the right place to hook in safely – an option will be to modify the return-value of “editor_element()”. But I don’t see a hook for that.
Does anybody here has an idea how to get this done?thanks
-ElmarAugust 14, 2017 at 2:42 pm #838671Hey Elmar,
What do you mean by this: “I also want to have a visual hint in the builder UI, to show that the element is disabled”? What kind of hint? Could you explain a bit more?
Best regards,
VictoriaAugust 16, 2017 at 5:55 pm #840020Hi Victoria,
sure, as a site is work-in-progress one might disable parts of the contents with my small code addition. There will be an additonal checkbox in my setup with “disable this element” if you edit an element. But in the overview you won’t see, if an element is currently disabled or not.
Here I’d like to add a class to the visual builder, if an element has the attribute “disabled” = trueIn this case I might render the layout builder like this:
http://www.evernote.com/shard/s2/sh/fee58f4e-0bb3-4de6-b0a9-9c64964cc252/41522809ee6427e12667302385256e55This will give us a similar functionality to Typo3, having active/inactive elements.
https://docs.typo3.org/typo3cms/EditorsTutorial/singlehtml/_images/PageModuleColumns.png (No. 4)I’d like the idea in visual composer, where the builder UI shows e.g. the current background image and color as small spots
http://www.evernote.com/shard/s2/sh/92418e73-fb51-49fc-87bd-a3c2397544f5/5b329753997778426fdfbf4897ffc1eeI would love to add similar extensions to the builder UI based on vaious attributes. But I don’t find an upgrade-safe place to add my code.
I hope this is more clearly.
Thanks
-ElmarAugust 17, 2017 at 4:54 am #840193Hi,
This isn
t included in our support
s scope. To accomplish it, you`ll need to hire a freelance.Best regards,
John TorvikAugust 18, 2017 at 4:47 pm #840923Hi John,
I am confused…. it’s not a problem coding the modification for me – but it will be lost with the next update and I am seeking a hint, if someone has an idea for an upgrade-safe way to get this done. I don’t see any hook, filter or other mechansim that allows me to override this core functionality.
Thanks
Elmar
August 21, 2017 at 10:25 am #841930sorry, to be more precise: I changed two files, one for the initial loading, one for immediate update after saving the modal dialog
/config-templatebuilder/avia-template-builder/php/shortcode-template.class.php
in create_sortable_editor_element()if( $params['args']['disabled'] ) { $class .= ' disabled'; }
and in config-templatebuilder/avia-template-builder/assets/js/avia-builder.js
in update_builder_html()if( values.disabled == 'aviaTBdisabled' ) { element_container.addClass('disabled'); } else { element_container.removeClass('disabled'); }
I am looking for a way/trick/hack to safely override these two points.
August 22, 2017 at 7:02 am #842329Hi,
Have you tried using the “avb_backend_editor_element_data_filter” filter? For the script, try to create an inline script with the “wp_admin” hook..
add_action( 'admin_head', 'ava_custom_admin_script' ); function ava_custom_admin_script() { // script here }
Best regards,
IsmaelAugust 24, 2017 at 8:13 pm #843670Hi Ismael,
thanks for your feedback. I checked my dev. theme here (might not be the latest, it is: 4.0.7), I don’t find a hook named “avb_backend_editor_element_data_filter”. It this something that has been added recently?
Hooking admin_head for JS is fine, but I am dependant one values inside the update_builder_html() method, thus I cannot simply oberserve the backend from “outside”.
Will keep on trying and researching ;-)Best
-ElmarAugust 24, 2017 at 8:20 pm #843671update: just checked 4.1.2 and found a bunch of new entry points,
Will check the updated code, before posting again here – thanks for pointing me into this direction.
-ElmarAugust 26, 2017 at 5:30 am #844281 -
AuthorPosts
- You must be logged in to reply to this topic.