Jump to content

[SOLVED] Remove Select Page/File from Insert Link Modal


Recommended Posts

Posted

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)

modal-links.PNG.8b29df7edb968729930bb75adc11b3b7.PNG

I think I remember someone asking the same thing some time ago...

Posted

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.

  • Like 2
Posted

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.

Posted
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;
}
 

Posted

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.

Posted
$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;
});

 

  • Like 2
  • Thanks 1
Posted

@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!

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...