Views Handler: Custom Sorting of Custom PHP-Script-Based Rendering

jeff00seattle's picture

Hi

I have created a custom views_handler_field that has multiple options, as defined within a customized method views_handler_field::options_form(), of rendering a returned value provided by $this->field_alias. The customized rendering of $this->field_alias are various PHP scripts based upon the selected option; e.g. If option A, then render alias value with PHP_A(), etc...

However, I am having difficulty deciphering the forums and documentation on which and how to provide clickable sorting these different renderings.

I am assuming that I should be implementing method click_sort(), but I am not sure if instead I should be implementing a custom views_handler_sort().

I look at examples for both possible solutions, and what I have seen so far is that sorting is based upon SQL queries upon the $this->field_alias. In other works SQL-based formulas applied to $this->query->add_orderby().

I do not want this because my custom renderings are not SQL-based but PHP script generated.

Pointers?

Jeff in Seattle

Login to post comments

Not sure if it's the same

kratib's picture
kratib - Thu, 2009-07-16 06:03

Not sure if it's the same thing, but the latest dev version of Views Custom Field (http://drupal.org/project/views_customfield) allows sorting the values created in PHP. Take a look at the code to see how I did it.