Blogs

Exposed filters form in your custom block for drupal 7

 

You may know how to get Exposed filters form from the particular view in the drupal7. In this week i was figuring out that how to get that Exposed filter form in our own custom block.

 

Of course, we have an option called "Exposed form in block" under Advanced setting while creating a view.

 

You can have a look at the following sample image which says not to have Exposed filter form as a block.

 

2

Custom Drag and Drop table rows in drupal 6

 

Have you aware of creating the custom drag and drop rows functionality for the table ?

I have got one solution for this and will be helpful for some of you :)

Let us start.

 

1. Define one menu item to build the form.

 

$items['table_drag_drop'] = array(

    'title' => 'Table Drag and Drop',

    'description' => 'To build the drag and drop form',

    'page callback' => 'drupal_get_form',

3

Add Custom date formats

 

Actually I was figuring out that we can have our own date formats using our custom code.

Of course some of you people might have done this.

Finally i have got the solution :)

 

$format_type = array();

$format_type['title'] = 'Custom';

$format_type['type'] = 'custom_date_format';

$format_type['locked'] = 0;

$format_type['is_new'] = 1;

date_format_type_save($format_type); //Save date format type to the database.

3

Pass PHP variables in javascript

 

If suppose, we want to initialize the javascript variable in PHP, we can use the fuction called drupal_add_js().

Here i am initializing the basepath value for the particular javascript variable.

 

<?php

    $jsVar = "var base_path = '". base_path() ."';";

    drupal_add_js($jsVar, 'inline');

?>

 

Try to alter it in javascript file.

2

Work with custom autocomplete form

 

Working with drupal autocomplete form is good, intead of using the jquery autocomplete.

 

Here we have a solution that how to create a custom autocomplete form and to get the user names or whatever.

I am giving the simple example of using it. Let's have a look into it.

 

Take a menu item in hook_menu to get the autocomplete form.This will call the function called 'test_autocomplete_form'.

 

$items['automplete_form'] = array(

        'title' => 'Test autocomplete form',

2

Pages

Subscribe to RSS - blogs