Jump to content

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?

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

  • Recently Browsing   0 members

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