This would be awesome IMHO. I've several modules in which I've placed a .install file just because the weight needed to be changed on installation. Putting this in a .info file would be much more efficient. Something like;

; $Id:$
name = Module
description = Description
package = Other
core = 6.x
weight = 2

Comments

dawehner’s picture

StatusFileSize
new2.36 KB

this is definite a good idea,
Additional its also logical, when we have exact this in system table, that there is a weight in theme info files.

here is a first patch:
which adds weight for both modules and themes

i'm wondering where there is the documentation for info files

still needs testing using a module_test.module :), anyone know wether a module file is required for a module?

dawehner’s picture

Status: Active » Needs review

oh forgot to set needs review

stborchert’s picture

Patch looks good and works as expected. Tested with a simple (empty and otherwise useless) module.

dawehner’s picture

StatusFileSize
new4.24 KB

so here is a new version with a included test.
together with a module_test.info and a module_test.module with another weight

moshe weitzman’s picture

I don't really see any point in clutterring the .info syntax with this. Is this reread on every submission of the modules form? Do existing weight adjustments get blown away. If not, then we are inconsistent with the module name and description and dependencies.

dries’s picture

Status: Needs review » Postponed

I think we should stay clear from adding things like weights to .info files. Their purpose is to describe the module, not to do configuration management.

skilip’s picture

Not to be cocky (well maybe just a little) but what's the differnce then between weight and for example version, or php-version? Beside that, I can understand we need to avoid cluttering of the .info system. Any suggestions on how we could declare a module's weight on installation? Maybe something like hook_module_registry_alter? Or change hook_theme_registry_alter into hook_system_registry_alter ?

webchick’s picture

skilip’s picture

@webchick: I don't think so. If so, adding weight into the .info file should have the same effect.

[edit]Why isn't it possible to hook into the modules registry process while the theme registry does?[/edit]

moshe weitzman’s picture

Many many modules do this with an update query to the system table in hook_enable(). see devel or og for example.

skilip’s picture

Still odd IMO opinion, having a weight column in the system table, but no possibility in core to do anything with it.

skilip’s picture

Title: Add weight declaration in .info files » Put weight declaration of modules into a core funtion

No opinions about this? Am I completely alone here?

dave reid’s picture

Status: Postponed » Closed (duplicate)

This is a duplicate of #127641: Module weight in .info