Jump to content

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


Klenkes
 Share

Recommended Posts

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...

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

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

$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
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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