Tag Archives: Drupal 7

BeansTag – Official release

After almost 2 years, the BeansTag module finally get through the review process and it is not officially released! If you want to find a simple tool to add page title and meta tags on your Drupal 7 website, BeansTag may be a good option for you.

BeansTag is a page title, meta tag and meta description management tool. You could add the above attributes to any path alias and they would be shown in the webpage. It fully support any pages including views, panel pages as well as nodes.

BeansTag also support multiple language since the language prefix in the path alias is also included when rendering the BeansTag.

Continue reading BeansTag – Official release

Drupal 7 – Add reset button to Webform

The Drupal Webform does not have the reset button by default. If you want to have one, you can create custom module to alter the form.

function <module>_form_alter(&$form, $form_state, $form_id) {
  if (strpos($form_id, 'webform_client_form_') === 0 || ($form_id=='user_register_form')) {
    $form['actions']['reset'] = array(
      '#type' => 'button',
      '#value' => t('Reset'),
      '#weight' => 100,
      '#validate' => array(),
      '#attributes' => array('onclick' => 'this.form.reset(); return false;'),
    );
  }
}

 

The above code will add the reset button to all Webform as well as the user registration form.

Done =)

Reference: Drupal Webform – ‘reset’ button

Drupal 7 – Render a view with contextual filter argument programmatically

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>);

 

Done =)

Reference: Outputting a Drupal 7 View programmatically with Contextual Filters (arguments)

Drupal 7 – Increase the number of values per field

A long time ago, i have a post about hacking into the CCK module so we could have more options when settings the number of values per field in the field setting page.
Drupal – Increase Views Relationship Delta Limit

This is a dirty approach as mentioned by eosrei.

So in Drupal 7, we can do it by creating a custom module and alter the field_ui_field_edit_form. Let’s implement the following hook_form_FORM_ID_alter() in a custom module.
Continue reading Drupal 7 – Increase the number of values per field