Introduction

The Weight module adds a weight option to enabled node types. Nodes with lower weight will float to the top of lists, while heavier items will sink to the bottom of lists. This is useful for sorting non-chronological nodes like bios, e-commerce products, or whatever you would like and for ordering nodes on the front page.

The "standard" Drupal sort order for nodes is by sticky, then by created date. Weight uses the node table's 'sticky' column to store weights as well as sticky information (so that feature is not lost). So then nodes will be sorted first by stickiness, then by weight, then by creation date.

This is a simple module with a simple purpose that can add a lot of value to your site with very little overhead.

Installation

Standard module installation applies.

Drupal 7.x-2.x

NOTE: Version 3 is used differently. See below for details.

Permissions

assign node weight
Allow modification of node weights.
administer weight
Administer configuration of the weight module.

Menu items

The only menu item is for the settings (see below).

Settings

To enable Weight for a content type, go to Administration » Structure » Content
types and select the content type you want to enable Weight for. Select the Weight
vertical tab, choose your desired settings, and click the Save button.

Setting weights

There are principally two ways of setting a node's weight. The first is when the node is created or
edited. The second is through the Content administration page.

Add / Edit

For enabled content types and users who have the appropriate permission, a fieldset will be added to
the node form for "Weight." Within this fieldset, you will find a selector box for the weight.

Content administration

On the Content administration page (Administration » Content), there will be a "Weight"
column containing a selector box to set the weight of any node with a content type that has been weight enabled.

 

Drupal 7.x-3.x

The module provides a new field type and widget called "weight" that can be added to a content type like any other field.

Drupal 6

Permissions

assign node weight
determines whether or not a user may set a node weight on the Add/Edit screen.

Menu items

The only menu item is for the settings (see below).

Settings

The module administration is at Administer » Site configuration » Weight. Access to this page is controlled with the administer site configuration permission.

Node Weight Range
This sets the range of weights that will be available.
Display On
This selects the content types that will be allowed to use weights.

Setting weights

There are principally two ways of setting a node's weight. The first is when the node is created or edited. The second is through the Content administration page.

Add / Edit

For enabled content types and users who have the appropriate permission, a fieldset will be added to the node form for "Node Weight." Within this fieldset, you will find a selector box for the weight.

Content administration

On the Content administration page (Administer » Content management » Content), the "Operations" column will contain a selector box for the weight of any node with a content type that was selected on the settings page.

Comments

Anonymous’s picture

There's also the undocumented views integration. You can create a view with the style "Weight changer" in order to create a drag'n'drop interface. Pretty easy to figure out.

Hyp1’s picture

I have seen this option, but i really dont know hot the template weight-view-weight.tpl.php
must look like.
Is there Information on that?

Cheers

NancyDru’s picture

I think the only documentation is in the readme file.

cluther’s picture

I'd like to highlight and call attention to Weight's views integration feature as an alternative to using DraggableViews ( http://drupal.org/project/draggableviews ) - which I have been unable to get working in D7.

To create a draggable view using the weight module:

  1. Install and enable the Weight module.
  2. Go to Administration > Structure > Content Types and select the content type you want to enable Weight for.
  3. Select the Weight vertical tab, choose your desired settings, and click the Save button.
  4. Go to Administration > Structure > Views, and create a new view.
  5. Create the view with a Table format and include the Weight field along with any other content fields you desire.
  6. Set the FILTER for 'Published = Yes' and 'Weight: Enabled = Yes'.
  7. Set SORT CRITERIA for 'Weight: Weight = Ascending'
  8. SAVE the view.

Your draggable view should now work as expected.

Note: I've encountered about couple of bugs, which I'm researching further and may end up filing bugs against.
(A) The order of the fields has an effect on the draggable function. For example field order TITLE, WEIGHT, OTHERFIELD displays the draggable icon whereas WEIGHT, OTHERFIELD, TITLE does not.
(B) I have a draggable view that works correctly when accessed directly. However when I use views_embed_view to place the view under a vertical tab the draggable icon disappears. You can still reorder by showing and adjusting row weights.

Cheers!

Chris

Chris Luther

garima singh’s picture

after uploading images , i want to save weight but weight is not saved please give solution

nabeelvst’s picture

Hi,
I have upgraded Drupal from Drupal 7.10 to 7.16. But after the upgrades the weight is showing against the content types but its not working. Any help would be appreciated. Do let me know if your required any other information regarding that. Thank You

NancyDru’s picture

Your issue will get much more attention if it is posted in the module's issue queue. http://drupal.org/project/issues/weight

Dimetry’s picture

There is no "Weight vertical tab" any more.
To use you have to add new field Weight to content type.

Anonymous’s picture

Thank You, I've been searching for it for a couple of hours :) :)

DrCord’s picture

thanks, the documentation needs updating, was going crazy!

PieterDeg’s picture

Thanks, I could have keep on looking for hours without your comment...

gswsdrupal’s picture

I was looking for the "Weight vertical tab" as well. info999 thanks for pointing this out!