I have a text format which should access by user role A and the admins but I only want the admins to see the "Source code" button. User's of the role A should not see this button but they should be able to use the exact same text format. Is there a way to achieve that without defining a new text format and handling all the text format during form building and entity saving?!

1 Answer 1


I had the same problem and was able to solve it with the hook_editor_js_settings_alter hook.
In "editorSettings" > "toolbar" I removed the entry for the "Source" button for my format after some logic.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.