I have the Profile, CCK, and Views2 modules installed on a Drupal 6 site. I added a string field to the user profile. I can filter easily on preset values, thru the Views GUI builder, really nicely. However, I'd like the filter criteria to be dynamically set based on other environment variables (namely the $_SERVER['SERVER_NAME']
).
Is there a basic 'How-to-write-a-custom-drupal-views-filter' somewhere out there? I've been looking thru the documentation, but it's not obvious to my simple mind on how to do it.
The Content Management Filter is a contributed module that adds an easier way for administrators to filter the content on a Drupal site for administration purposes.
The Filter core module allows you to configure text formats for processing text input for your site. These settings are under Configuration > Content authoring > "Text formats and editors" ( /admin/config/content/formats ).
You can create your own function like following to add your own filters.
<?php custom_views_embed_view($view_name, $display_id) {
$view = views_get_view($view_name);
$view->set_display($display_id);
$id = $view->add_item($display_id, 'filter', 'node', 'created',
array( 'value' => array('type' => 'date', 'value' => date('c')), 'operator' => '<='));
return $view->execute_display($display_id);
}
?>
I have a similar problem and this article has been very helpful in resolving the problem.
http://www.metaltoad.com/blog/drupal-7-tutorial-creating-custom-filters-views
And hook_views_data oficial documentation
http://api.drupal.org/api/views/docs%21docs.php/function/hook_views_data/6
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With