Modify Views Exposed Filter
Submitted by system on Mon, 01/06/2014 - 14:24The task was to change text field to a select list with a given set of option. The text field was an integer field and the select options were numbers to select from 0 to 30.
The task was to change text field to a select list with a given set of option. The text field was an integer field and the select options were numbers to select from 0 to 30.
There are times when the serial field needs to start from a number other than 1. To do so the following sql query will do the task. It sets the start number to be 100404.
alter table serial_table_field_name auto_increment = 100404;
The following snippet changes the views exposed form Apply Button to Search Jobs. Make the changes in template.php file of the currently enabled default theme. Clear cache to see it work.(Clear class registry cache to be precise.)
<?php
function YOUR_THEME_NAME_preprocess_views_exposed_form(&$vars, $hook){
// only alter the required form based on id
// drupal_set_message(t("form id: ".$vars['form']['#id']), 'status', FALSE);
if ($vars['form']['#id'] == 'views-exposed-form-search-openings-page') {
// Change the text on the submit button
For Drupal6 , it is recommended to use menu_get_object()
<?php
/**
* Convert the HTML into a PDF and store it in a particular location.
* In this example, the dompdf library is stored under libraries folder in Drupal.
*/
function ji_custom_convert_pdf($user_html){
//Get path of dompdf folder under libraries
set_include_path(libraries_get_path('dompdf'));
require_once "dompdf_config.inc.php";
$dompdf = new DOMPDF();
$dompdf->load_html($user_html);
$dompdf->render();
$output = $dompdf->output();
file_put_contents("sites/default/files/resume/".$user->name."_resume.pdf", $output);
}
?>
--
The Entity API provides wrapper classes you may use to make dealing with the values of an entities properties and fields easier. Wrappers make it easier to get and set the values of fields and properties as well as to programmatically retrieve additional information about these elements and iterate over lists of values in a consistent manner.
This implies that one need not worry about fetching a node property in the format:
$node->field_name['und'][0]['value']
The following is a snippet on how to enable fields to appear and/or disappear based on the state of other fields.
<?php
/**
* Modifications for including State API functionalities. The idea is to hide the fields field_referme_industry
* and field_referme_major_skills, based on the value of another field.
* The functionality can be implemented during the after_build phase
*/
function jc_form_alter(&$form, &$form_state, $form_id) {
//drupal_set_message("Form Id is: $form_id ");
if($form_id == 'referme_node_form') {
Nivo slider is a nice tool for front page slideshows. The reasons you should try Novo are:
However, Nivo seems to be getting shipped with persistent bugs. The following fixes are required to get expected behaviour from Nivo.
Problem #1. Small image appearing on top left before each transition.
Solution: Add the following to custom CSS:
.nivoSlider img { max-width: none; }
The idea is to modify another CCK field based on selection of an item via a select list in another field.
Let us consider a content type called article containing 2 additional fields: article_test_entity - which is an entity reference that displays node titles of all nodes and article_test_entity_type - which is a select list that contains Content Type names list with its key as the actual machine name of the content type. The idea is to restrict the list of node titles displayed on article_test_entity based on the content type selected via article_test_entity_type.
<?php
/*
The following lists all the permissions available in Drupal.