In the HKNA project, i exposed a flag in a view but it turns on the available option names are True and False instead of Yes and No.
1. Download and enable the Views Send module module.
2. Create a new user view in Table format.
3. Add the User: E-mail as well as the Global: Send e-mail field.
Yesterday we talked about exporting data using the Views data export module.
Drupal 7 – Export view data CSV, XML, XLS by Views data export module
The module also provides a Drush command such that you can run the export command in the server which is convenient for backend integration.
The following command is stated in the project page.
- drush views-data-export [view-name] [display-id] [output-file]
Some days ago, i write a blog post about how to render a Drupal 7 block programmatically.
Drupal 7 – Render a Block programmatically
If the block is created by Views, there is a simpler solution provided by the Views API. And we can also pass the contextual filter argument too.
print views_embed_view(<view machine name>, <display id>, <arg 1>);
The following piece of code render the Views Exposed Filter.
$view = views_get_view('<view name>'); $display_id = 'page'; $view->set_display($display_id); $view->init_handlers(); $form_state = array( 'view' => $view, 'display' => $view->display_handler->display, 'exposed_form_plugin' => $view->display_handler->get_plugin('exposed_form'), 'method' => 'get', 'rerender' => TRUE, 'no_redirect' => TRUE, ); $form = drupal_build_form('views_exposed_form', $form_state); print drupal_render($form);
Sometimes the content types we created are only used in Views. We don’t want to have the node view page for those content. The following solution would turn those unwanted node view pages to 404 not found.
Create a custom module and implement the hook_node_view() as follow.
Sometimes we may want to update multiple nodes at once. Views Bulk Operations may help if you want to set the same value for a field of multiple nodes. But if you want to set different values among a set of nodes, then Views Bulk Operations could not help.
1. Download and enable the module. (I used the 7.x-1.x-dev version)
2. Create a view with table format. (This is not necessary but better user interface)
Yesterday we have talked about how to use selection list for selecting Entity reference in Views exposed filter.
Drupal 7 – Selection list for Entity reference in Views exposed filter
Now i want to have more control on the selection list. For example, i have a content type called competition and i want to limit the number of options in the Entity reference selection list. In this case, we have to create a custom module and alter the views_exposed_form.