Multiple filed handlers in Views for a field How do I set multiple field handlers in Views on a single field.

I've applied the patch Relationship &amp; sort for {history} to Views which brings in the user relationship on the history table. I then replaced the Views field handler for ['history']['timestamp'] in node.views.inc with this:

  $data['history']['timestamp'] = array(
    'title' =&gt; t('Node last access timestamp'),
    'field' =&gt; array(
      'handler' =&gt; 'views_handler_field_date',
      'click sortable' =&gt; TRUE,
      'help' =&gt; t('Show the timestamp a node was last accessed by user.'),
    ),
    'sort' =&gt; array(
      'handler' =&gt; 'views_handler_sort_date',
      'help' =&gt; t('Sort by the node last access time.'),
    ),
    'filter' =&gt; array(
      'handler' =&gt; 'views_handler_filter_date',
      'help' =&gt; t('Filter by the node last access time.'),
    ),
  );


because I need the timestamp as a date field. Normally it is this:

$data['history']['timestamp'] = array(
    'title' =&gt; t('Has new content'),
    'field' =&gt; array(
      'handler' =&gt; 'views_handler_field_history_user_timestamp',
      'help' =&gt; t('Show a marker if the content is new or updated.'),
    ),
    'filter' =&gt; array(
      'help' =&gt; t('Show only content that is new or updated.'),
      'handler' =&gt; 'views_handler_filter_history_user_timestamp',
    ),
  );


But ideally I would like to have both field handlers available because I do not want to remove the default handler in Views. How do I do this?
You don't. That's not possible.

But you still have options:


Define your own field handler and add support for multiple display formats using configuration options, have a look at this snippet for an example: https://gist.github.com/juampy72/5816530. The key methods to implement this are option_definition, options_form, options_submit and render.
This is more of a work-around. Copy the definition of the first field handler under different database column key, e.g. $data['history']['timestamp_as_date'] = array( .... Then implement your own filter class as before, but also override the query method in order to ensure that the timestamp column is present. Then display that as you like.


There are a lot of code examples out there.