Friday, June 29, 2012

Module - Clientside Validation Usage

The main module (Clientside Validation) provides the core functionality for Clientside Validation. However, it does nothing by itself, it needs at least one of its submodules to provide any real functionality. The submodules are:
  • Clientside Validation FAPI: Provides Clientside Validation for the Form API Validation module.
  • Clientside Validation Field Validation: Provides Clientside Validation for the Field validation module (Drupal 7 only).
  • Clientside Validation Form: Provides Clientside Validation for standard Form API elements.
  • Clientside Validation HTML5: Provides Clientside Validation for HTML5 elements (see Drupal HTML5 Initiative, Drupal 7 only).
  • Clientside Validation Webform: Provides Clientside Validation for the Webform and Webform Validation module.
Read More.....

www.drupal.org

Module - Clientside Validation

This module adds clientside validation (aka "Ajax form validation") for all forms and webforms using jquery.validate. The included jquery.validate.js file is patched because we needed to be able to hide empty messages.

Read More....

www.drupal.org

Tuesday, June 26, 2012

Theming Guide

This handbook is about customizing the look and feel of a Drupal site. We'll show you how you can modify the appearance of your Drupal site without requiring expert knowledge of programming. And if you wish to go further, we cover that too.
This guide assumes some knowledge of HTML and CSS but no PHP programming knowledge is necessary. It also assumes you have administrator's privileges to a Drupal site. You might also want to familiarize yourself with some of the terminology used in Drupal. We concentrate on Drupal 7 with notes for Drupal 6 where applicable.

Other Places to Explore


Read More...

www.drupal.org

Thursday, June 14, 2012

What's New in Drupal 7

New Minimum System Requirements:

This is not a complete list of requirements. Please read the complete list of requirements.
  • Database: MySQL 5.0.15 or PostgreSQL 8.3
  • PHP Version 5.2 or higher
  • PHP Memory: 40M - 64M

Security:

  • More secure implementation for scheduled tasks (cron.php).
  • More secure password system.
  • More secure log-in system.
  • Modules can be updated via the web.

Usability:

  • Administrative links to edit existing page elements are now available on each web page, without having to go to an administration page first.
  • Improved support for integration of WYSIWYG editors.
  • Added more drag-and-drop for administrative tasks.
  • Permissions now have the ability to handle more meta-data (permissions now have a description).
  • User 1 created as part of the installation process.
  • Added features to the default install profile (tagging on the Article content type).
  • Setting up automated task runs (cron) can now be achieved via Drupal's configuration alone, without having to install any scripts on the web server.
  • Redesigned password strength validator to make it kinder and gentler, and clearer.
  • Renamed "input formats" to "text formats".
  • Added support for default text formats to be assigned on a per-role basis.
  • Moved text format permissions to the main permissions page
  • Added "vertical tabs", a reusable interface component that features automatic summaries and increases usability.
  • Improved time zone support
  • Removed per-user themes: Contributed modules with similar functionality are available.
  • Added new "Shortcuts" module to allow user to create their own menu for the pages they visit the most.

Database:

  • Added query builders for INSERT, UPDATE, DELETE, MERGE, and SELECT queries.
  • Support for master/slave replication, transactions, multi-insert queries,delayed inserts, and other features.
  • Added support for the SQLite database engine.
  • Default to InnoDB engine, rather than MyISAM, on MySQL when available for greater scalability and data integrity.

Several Performance Improvements Implemented

Documentation:

  • Hook API documentation now included in Drupal core.

News aggregator:

  • Added OPML import functionality for RSS feeds.
  • Added feed update options.

Search:

  • Added support for language-aware searches.

Testing:

  • Added test framework and tests.

Theme system:

  • Removed the Bluemarine, Chameleon and Pushbutton themes. These themes live on as contributed themes
  • Added "Bartik" theme as the default user interface theme.
  • Added "Seven" theme as the default administration interface theme.
  • Added "Stark" theme to make analyzing Drupal's default HTML and CSS easier.

File handling:

  • Files are now first class Drupal objects with file_load(), file_save(),
    and file_validate() functions and corresponding hooks.
  • Files use PHP stream wrappers to enable support for both public and private files and to support pluggable storage mechanisms and access to remote resources (e.g. S3 storage or Flickr photos).
  • Added a field specifically for uploading files, previously provided by
    the contributed module FileField.

Image handling:

  • Improved image handling, including better support for add-on image
    libraries.
  • Added a field specifically for uploading images, previously provided by the contributed module ImageField.

Better Support for Multisite Installations

Added RDF support

Better support for search engine optimization and web linking

Added ability to add custom fields

  • Provides most of the features of the former Content Construction Kit (CCK) module.
  • Custom data fields may be attached to nodes, users, comments and taxonomy terms.
  • Node bodies and teasers are now fields instead of being a hard-coded property of node objects.
  • Fields are translatable.

Installer can be run from the command line

JavaScript changes

  • Upgraded the core JavaScript library to jQuery version 1.4.2.
  • Upgraded the jQuery Forms library to 2.36.
  • Added jQuery UI 1.8, which allows improvements to Drupal's user experience.

Improved node access control system

Task handling

  • Improved handling of long-running tasks.
Read More ...

www.drupal.org

Wednesday, June 13, 2012

Drupal 7 Learnings


A few months ago Drupal 7 was released and ever since then we've been working hard to adapt to the changes. Here are some of the things that I've learnt over the last few months. Thought it would be a good idea to share it with the community. Do let me know your thoughts about these in comments section below !
Development Learnings

1) There is a change in the filter format table in d6 and d7
     - In d6 it is named as filter_formats and  in d7 it is filter_format and  even the fields are different.

2) We no longer need drush for migration. Now we can migrate data from the administrator interface itself. But the drawback of this is we can't use the “itemlimit” and “idlist” to restrict node creation.

3) We no longer have the nodeapi function. Now to use any $op of the nodeapi we need to call the function node_<op>.
        e.g. if we wish to call the ‘insert’ $op , we will use hook_node_insert()

4) We no longer have the db_result() function. This is how we can use it in D7 : db_query({...})->fetchField();

5) Learned how to carry out the functionality of sorting the list of contents alphabetically using views and glossary view [default view=> need to enable it].
Even how to show up all the letters whether it contains the content or not by overriding the views tpl i.e. views-view-summary-unformatted.tpl file located in the view module.

6) Learned how panels can be used with menus.

7) We no longer have the db_fetch_array() function. Now the db_result() function will return the prepared statement object, already executed.

8) Argument 2 passed to db_query() must be an array
       eg: db_query('SELECT n.nid, n.title, n.created FROM {node} n WHERE n.uid = :uid', array(':uid' => $uid));

9) Customized the default “addThis module” links. Overridden the theme function of the addthis button function.

10) How to add active classes on the thumbnails being generated using views_slideshow.

11) Mailchimp integration and its working.
      Just create an account in the mailchimp and create a form with all the fields being added.Just copy and paste the code being highlighted under the “Share it” tab.

12) Pulling up the tweets from multiple accounts using the list widget.  
      In the respective account, just create a new lists and visit the profile of the accounts that need to be added. Add the respective accounts in the lists so created and using the list widget embed code, paste the code.

13) In the webform, how to send mails to different mail accounts on submitting the form.
      Under the form components of type “Select list”, instead of inserting the key values just insert the respective mail address and under the email settings, just select the component name.

14) While writing the custom code, for the fields that are not mandatory do ensure that “if” condition is being posed so that the error of “Undefined und in function()” does not occur. E.g,

if($node->field_blog_image != NULL) {
    $img = $node->field_blog_image['und'][0]['uri'];
}

15) How to provide description to the feeds page
     While using views of type feeds, override the template file of “style output” and enter the text to be displayed between the <description> </description>

New Module Implementation:

1) Inline Form Messages:
    Used for showing up the error messages under each fields.

1) Menu_block:
   Used for showing up the menus where active menu parent will be shown as expanded and
   rest parent item as unexpanded.

3) Menu position:
   Used to insert the menu item in the specified position.

4) Unique field:
   Used to mention the fields to be unique in nature like for a textfield to be unique i.e once the
   number has been entered then no other content can contain that same number.

5) Menu attribute:
   Used to add unique id’s, classes and styles to a particular menu item.It becomes easier when javascript or jquery is being applied to the menu item.

6) AddThis module:
   Used to provide the contents to be added on various medium of networks.

7) Views_slideshow:
    Used for providing the slideshow.Customization of this was the new learning

8) Mailchimp
   Used for having integrating the form with the mailchimp.

New API Changes in D7

1) For applying imageache, use
   image_style_url($style_name, $path)
  where,
  $style_name = the imagecache preset
  $path = the path being mentioned in the field[‘uri’]
 
2) For making the image linkable,
   l($text, $path, array $options = array())
   where,
   $text = the one which is to be made linkable
   $path = the path where it is to be linked to
   $options = array(‘html’=>true) [for images]

3) Sql query change. Use
$node_nid=63;
db_query(‘SELECT title FROM {node} WHERE nid=:nid’,array(':nid'=>$node_nid))
foreach() {}
Theming Learnings
1) If you want to add any class in body use yourthemename_preprocess_html function in d7 .
2) If you want create any content type node.tpl.php then use ‘Double hypen’’ ‘--’  ex : node--article.tpl.php in d7 . In d6 we use only ‘Single hypen’ ‘-’

Module - WYSIWYG Filter

The WYSIWYG Filter module provides an input filter that allows site administrators configure which HTML elements, attributes and style properties are allowed. It also may add rel="nofollow" to posted links based on filter options. It can do so with no additional parsing on user input. That is, it may apply nofollow rules while parsing HTML elements and attributes.
The filter is based on whitelists that can be defined from the filter settings panel. Rules for HTML element and attributes are defined using the same syntax of the TinyMCE valid_elements option.

Read More.....
www.drupal.org

Setting up variables for use in a template (preprocess and process functions)

The main role of the preprocessor is to set up variables to be placed within the template (.tpl.php) files. Plain theme functions do not interact with preprocessors.
Notes:
  • Preprocessors are also used for providing template suggestions.
  • In versions 5 and below, the function _phptemplate_variables served the same purpose. It has been deprecated in 6.
  • Prior to Drupal 6.7, for your theme to have its preprocessors recognized, the template associated with the hook had to exist inside the theme. When a default template exists, copy it to your theme and clear the registry (or you should really be upgrading to a later version of Drupal anyway for security reasons, at which point you don't have to worry about this).
Read More..
www.drupal.org

Wednesday, June 6, 2012

Last Updated

<div class="ftr_last_updated clear"> <?php print t('Last Updated on:'); ?>
  <?php
       $format2 = 'd-m-Y';
       $result2 = db_query("SELECT title, changed FROM {node} WHERE status = 1 ORDER BY changed DESC");
        if ($node = db_fetch_object($result2)) {
           $output2 .= date($format2, $node->changed);
         }
          print $output2;
  ?>
</div>

Module - CKEditor - WYSIWYG HTML editor

This module will allow Drupal to replace textarea fields with the CKEditor - a visual HTML editor, sometimes called WYSIWYG editor. This HTML text editor brings many of the powerful WYSIWYG editing functions of known desktop editors like Word to the web. It's very fast and doesn't require any kind of installation on the client computer.

What is CKEditor?

CKEditor is the next version of FCKeditor. The editor has been rebranded and completely rewritten. It is now much faster (the code has been optimized), loads faster (the number of files has been reduced, so the browser will perform less HTTP requests) and developers friendly.

Read More 
www.ckeditor.com/ckeditor-for-drupal 
www.drupal.org/project/imce
www.drupal.org

Friday, June 1, 2012

page.tpl.php

General utility variables:
  • $base_path: The base URL path of the Drupal installation. At the very least, this will always default to /.
  • $css: An array of CSS files for the current page.
  • $directory: The directory the theme is located in, e.g. themes/garland or themes/garland/minelli.
  • $is_front: TRUE if the current page is the front page.
  • $logged_in: TRUE if the user is registered and signed in.
  • $is_admin: TRUE if the user has permission to access administration pages.
Read More

www.drupal.org

only show translated menu items into current language (Drupal 8)

function MY_THEME_preprocess_menu(&$variables) {   if ($variables['menu_name'] == 'brancott-header-menu') {    $langu...