I was trying to create a subclass of space_og class and override some of its methods. the problem is that when the space object is initialized, it ignores my subclass and gets the name of the class specified by spaces_og_spaces_types().
hook_spaces_types_alter would make possible to override the behavior of a certain space type without creating a new one.

CommentFileSizeAuthor
hook_spaces_types_alter.patch643 bytesferdi

Comments

yhahn’s picture

Assigned: Unassigned » yhahn

I like this idea a lot and will look into any issues there might be (the only one I can think of is nice parent/autoloading like Views has : ) Probably won't be necessary for a while since the class hierarchy here is nearly nonexistent.

Ian Ward’s picture

Just posting some notes for the record. I tried this out. The problem I ran into was that there's no autoloading of classes. For example, if I do:


class space_og_archive extends space_og {

then I'll run into a situation where class space_og cannot be found. Weighting modules get round this, but is not the solution.

damien tournoud’s picture

Title: introduce hook_spaces_types_alter » Introduce hook_spaces_types_alter
Version: 6.x-2.0-beta1 » 6.x-2.0-beta6
Status: Active » Needs review

Autoloading is absolutely unrelated, and should not block this patch. A subclass can easily load its parent class manually.

jmiccolis’s picture

Version: 6.x-2.0-beta6 » 6.x-3.0-beta4
Priority: Normal » Critical
Status: Needs review » Fixed

Bumping version, and raising priority.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.