Jump to content
Klenkes

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

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

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
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;
}
 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...