home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (pathauto.js)

This example Drupal source code file (pathauto.js) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

attr, automatic, checked, disabled, div, edit-path-wrapper, edit-pathauto-perform-alias, else, function, if, php, return, size, var

The pathauto.js Drupal example source code

// $Id: pathauto.js,v 1.4.2.2 2010/02/10 21:50:30 greggles Exp $
if (Drupal.jsEnabled) {
  $(document).ready(function() {
    if ($("#edit-pathauto-perform-alias").size() && $("#edit-pathauto-perform-alias").attr("checked")) {
      // Disable input and hide its description.
      $("#edit-path").attr("disabled","disabled");
      $("#edit-path-wrapper > div.description").hide(0);
    }
    $("#edit-pathauto-perform-alias").bind("click", function() {
      if ($("#edit-pathauto-perform-alias").attr("checked")) {
        // Auto-alias checked; disable input.
        $("#edit-path").attr("disabled","disabled");
        $("#edit-path-wrapper > div[class=description]").slideUp('fast');
      }
      else {
        // Auto-alias unchecked; enable input.
        $("#edit-path").removeAttr("disabled");
        $("#edit-path")[0].focus();
        $("#edit-path-wrapper > div[class=description]").slideDown('fast');
      }
    });
  });

  Drupal.verticalTabs = Drupal.verticalTabs || {};

  Drupal.verticalTabs.path = function() {
    var path = $('#edit-path').val();
    var automatic = $('#edit-pathauto-perform-alias').attr('checked');

    if (automatic) {
      return Drupal.t('Automatic alias');
    }
    if (path) {
      return Drupal.t('Alias: @alias', { '@alias': path });
    }
    else {
      return Drupal.t('No alias');
    }
  }
}

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal pathauto.js source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.