Custom views handler without table This seemed easy at first but I'm losing my hair on this.

I simply want to add a custom view handler that uses no table.

I tried to do as views php proposed, $data['views']['mycustomfield'] in hook_views_data, but still, "mycustomfield colum not found".

Any help ? Thanks !
Actually its easy. Just look at the implementation Views Global handlers which is available in views.views.inc.

Below is the example how you can add field handler without having a table,


Specify your custom handlers in hook_views_data like below,

/**
 * Implements hook_views_data().
 */
 function my_module_views_data() {
   $data['custom']['table']['group'] = t('Custom');
   $data['custom']['table']['join'] = array(
     // #global is a special flag which let's a table appear all the time.
     '#global' =&gt; array(),
   );

   $data['custom']['custom_handler'] = array(
     'title' =&gt; t('Custom Handler'),
     'help' =&gt; t('Custom Handler.'),
     'field' =&gt; array(
       'handler' =&gt; 'views_handler_custom_handler',
     ),
   );

   return $data;
}

Create a inc file for your handler an put your logic there. something like below
Here the file name would be views_handler_custom_handler.inc

/**
 * A handler to provide a field that is completely custom by the administrator.
 *
 * @ingroup views_field_handlers
 */
 class views_handler_custom_handler extends views_handler_field {
   function query() {
     // do nothing -- to override the parent query.
   }

   function option_definition() {
     $options = parent::option_definition();

     // Override the alter text option to always alter the text.
     $options['alter']['contains']['alter_text'] = array('default' =&gt; TRUE);
     return $options;
   }

   function options_form(&amp;$form, &amp;$form_state) {
     parent::options_form($form, $form_state);

     // Remove the checkbox
     unset($form['alter']['alter_text']);
     unset($form['alter']['text']['#dependency']);
     unset($form['alter']['text']['#process']);
   }

   function render($values) {
     // Render your content.
     return 'Sample';
   }
}

Specify this new handler file in your module's info file
Clear the caches


Now the new field handler will be there in the field list.