Hello,

I just modified a bit my node.module in order to be able to change the length of my teasers and see the change take effect immediatly, without having to manually edit every single one of them.

I'm passing by the patch, although it needs (probably) some slight work and surely some review. Not being a drupal expert, I might have missed something.

From reading the code of the node_save function, I respected the fact that if the teaser wasn't generate, just don't do it (as said in the comment provided : Auto-generate the teaser, but only if it hasn't been set (e.g. by a module-provided 'teaser' form item). )

The form generated isn't very nice, maybe a radiocheckboxes with Disabled and Enabled might be better.

acp

CommentFileSizeAuthor
node_module_update_teasers.patch.txt2.5 KBacp

Comments

acp’s picture

Btw, I don't think this is the better place to place the code, but I couldn't really see where else it could be inserted. If a better solution exists, please do point it out to me...

Thanks in advance

pwolanin’s picture

If you want to suggest this as a feature for core, change the version to cvs- no new features are being added to 4.7.

As an alternative, you could try to make this an add-on module. You could probably use hook_form_alter to add your checkbox to the form of interest. Then, rather than updating all nodes all at once, why not use hook_cron to update batches? The way you have it written might hang up a large site and/or execced the PHP execuation limit.

acp’s picture

Version: 4.7.2 » x.y.z

Indeed for big sites, this could be troublesome. But doesn't hook_cron rely on cron itself ? If yes, then it might be a problem for all those not having access to such a process... (like me for instance :)).

I'll check the add-on module possibility, wasn't aware of the hook_form_alter method. Does it allow me however to modify the form of the node module, without having to alter the node.module file itself ? (I'll read the api specification too)

If so, I could add a range field to "select" a range of nodes' teasers to retrim (maybe also first treat the ones that are on the frontpage). I'll give it a thought.

As for the Version, changed to cvs.

Thanks

acp’s picture

Status: Needs work » Closed (fixed)

I decided to change this to a module, hook_form_alter() being a satisfying solution. However, there is a necessity for a solution that should be integrated to the core system.

My proposition is way too restricted, therefore I close the issue. Might re-propose later on, something more "complete".

acp