Introduce hook_spaces_types_alter

ferdi - July 6, 2009 - 21:32
Project:Spaces
Version:6.x-2.0-beta6
Component:Code
Category:feature request
Priority:normal
Assigned:yhahn
Status:needs review
Description

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.

AttachmentSize
hook_spaces_types_alter.patch643 bytes

#1

yhahn - July 9, 2009 - 13:51
Assigned to:Anonymous» 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.

#2

Ian Ward - July 15, 2009 - 18:41

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:

<?php
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.

#3

Damien Tournoud - December 9, 2009 - 10:34
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.

 
 

Drupal is a registered trademark of Dries Buytaert.