hey there,

following that issue I filed (#553886) I noticed trashed content can be trashed again. so I'd like to suggest that on the edit page of some trashed content, the trash button be replaced with an un-trash button. and of course, the integration with rules would be via an event called "Trashbin: Node has been untrashed" which would cause it to be re-published ;]

I can't write that on my own, but I'll be glad to test.

cheers,
Luciano

Comments

crea’s picture

Status: Active » Postponed

Yes there is issue with trash button still appearing. It's because this module doesn't know if node is trashed, it simply doens't store it's state. It seems like minor issue because "trash" operation in most cases available to privileged users such as admins or moderators and they can be aware that button doesn't hide. You can simply insert some action which will mark this node ( for example, using Flag module, or Workflow module) so your privileged users will still see button but will be aware of the state.
I was going to implement that, but decided to leave "marking" of trashed node to site admin. Implementing states would duplicate functionality of Flag module, and I intended to keep Trashbin as simple as possible, so I decided to not implement this in Trashbin and instead wait when Flag implements access control so Trashbin would become simply "button" flag type for Flag.
I am watching Flag development, so in case Flag access control will never be implemented in reasonable timeframe, I will advance Trashbin so it will store and use node states.

luco’s picture

I have an idea. could be absolute rubbish.... in which case just trash it. ;]

well, Trashbin doesn't store a node's state, but Workflow does. then maybe we could have some sort of three-way integration: a certain node gets trashed, its state changes to "trashed" on its respective workflow, and *then* Rules will have something to work on - based on the Workflow state.

if this is possible, you won't have to bother with Flag module and only write a few lines of code in tandem with Workflow and Rules' maintainers. how about it?

crea’s picture

You can hide it yourself, just implement hook_form_alter() which checks workflow state (for example) and removes "trash" button from the form depending on node state. I will not do it myselft because I think state must be stored inside "marking" module, in our case Trashbin itself, otherwise it has to support fetching node state outside of _every_ integration module.
And if I get state only from Workflow module it will make Trashbin less flexible and make it depend on Workflow, which wasn't my original intention.
In case you can't program it yourself, you have only option to wait :) or find other solutions..

luco’s picture

ok, how do I go about implementing hook_form_alter() ? I'm kinda not good with such customisations. if you could help me, please?

crea’s picture

something like this:

function yourmodule_form_alter() {
  if ( node form check and workflow state check here ..) {
    unset(button form element here..);
  }
}
crea’s picture

Status: Postponed » Closed (fixed)