Jump to content
dragan

Selector Inputfield question: define fields in results preview

Recommended Posts

I wonder if it is possible to customize the inputfield selector: It's working fine as is, but when you click on "matches the following pages", the modal shows columns which sometimes don't make sense (e.g. if I select template=basic_page, I get fields first_name + last_name). That was probably my column selection I made the last time I used the default Finder Lister.

Are those stored in cookies or sessions? It would be nice to define preview-columns in the field instance itself, after the initial selector definition.

Someone got an idea?

Share this post


Link to post
Share on other sites

It looks like there are many settings that can be defined for InputfieldSelector, but only initValue can be set via the FieldtypeSelector field config. For the others you have to use a hook.

The previewColumns setting controls the columns shown:

$wire->addHookBefore('InputfieldSelector::render', function(HookEvent $event) {
	/* @var InputfieldSelector $inputfield */
	$inputfield = $event->object;
	// Only for the FieldtypeSelector field of the given name
	if($inputfield->hasField != 'test_selector') return;
	// Define the columns you want
	$inputfield->previewColumns = ['name', 'template', 'modified'];
});

 

 

  • Like 3

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