Klenkes Posted November 9, 2019 Share Posted November 9, 2019 I have a website mainly for members of an association. The members have very restrict permissions on page edit. On their profile page they have two fields where they may enter text and link somewhere. But I don't want them to link internally or to files, let alone mess with attributes. Is there a hook to remove those things on a template basis? (It's not the user template) I think I remember someone asking the same thing some time ago... Link to comment Share on other sites More sharing options...
dragan Posted November 9, 2019 Share Posted November 9, 2019 Create another textarea field, type CKEditor, and in the RTE settings simply replace PWLink with Link, this will give you CKEditor's default link dialog. To customize that CKE plugin, you'll have to dig into their docs / code. Maybe this is a good start. 2 Link to comment Share on other sites More sharing options...
Klenkes Posted November 9, 2019 Author Share Posted November 9, 2019 Good idea! I totally forgot about the native plugin. If nothing else works I will go that way. But I was hoping that superuser and moderators still have the PWLink plugin available to correct any mistakes that the members made. Link to comment Share on other sites More sharing options...
dragan Posted November 9, 2019 Share Posted November 9, 2019 14 minutes ago, Klenkes said: But I was hoping that superuser and moderators still have the PWLink plugin available to correct any mistakes that the members made. Then simply add both, and hide the PWLink items via a hook (based on role) + CSS: Inspect such a page, and find the two buttons (pw link + unlink). Each have unique IDs: body.ProcessPageEdit-template-basic-page #cke_43, body.ProcessPageEdit-template-basic-page #cke_44 { display: none; } Link to comment Share on other sites More sharing options...
Klenkes Posted November 9, 2019 Author Share Posted November 9, 2019 This is a good idea. Since I use AOS anyway I added it to my $fieldoverrides and removed module and button based on the userrole. Thanks. Link to comment Share on other sites More sharing options...
Zeka Posted November 10, 2019 Share Posted November 10, 2019 $wire->addHookBefore('InputfieldForm::render', function(HookEvent $event) { $form = $event->object; if($form->id !== 'ProcessPageEditLinkForm') return; $inputfields = $form->children('name=link_page_id|link_page_file'); foreach ($inputfields as $inputfield) { $inputfield->collapsed = Inputfield::collapsedHidden; } $tab = $form->child('id=link_attributes'); $tab->collapsed = Inputfield::collapsedHidden; }); 2 1 Link to comment Share on other sites More sharing options...
Klenkes Posted November 10, 2019 Author Share Posted November 10, 2019 @Zeka Thank you very much! This is exactly what I am looking for. Short, clean and safe. Everything else I tried before didn't really work because of javascript sideeffects and all got confusing. Have a nice Sunday! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now