Jump to content

[SOLVED] How to hook on lister to display options values instead of titles?


Recommended Posts

Posted
wire()->addHookAfter('FieldtypeOptions::markupValue', function($e){
    $page = $e->arguments(0);
    $e->return = $page->select_options_field->id;
});

 

  • Like 2
Posted

Thanks for the hint @elabx

Your code makes ALL options fields available in the Lister columns to display the same values. Here is how I did it:

$wire->addHookAfter('FieldtypeOptions::markupValue', function($event) {

  if($this->process != 'ProcessPageLister') return;

  $field = $event->arguments(1);
  $value = $event->arguments(2);

  if($field == "my_options_field") {
    $event->return = $value->value;
  }

});

 

  • Like 1
  • PWaddict changed the title to [SOLVED] How to hook on lister to display options values instead of titles?

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