As some add-on developers have complained, especially XenForo add-on developers, it is not possible to extend many VaultWiki core classes if needed by the add-on -- at least not without requiring vault/config.php changes, and not without interfering with other similar add-ons.
In the next release, VaultWiki will feature a class proxying system similar to the system XenForo uses. The system can be accessed using new effect locations vw_load_controller, vw_load_model, and vw_load_view through your forum software's existing plugin system and creating the plugin normally.
The vw_load_* events work similarly to XenForo's load_class events, but there are some slight differences in the code contents for VaultWiki:
Code:
if ($baseClass == 'Path/to/Class') // not including vw, Controller/etc, or dependency
{
$extends[] = 'My/Class';
}
Your class should be defined as follows (using controller-type as an example), in
vault/plugins/controller/my/class/vw.php:
Code:
class vw_My_Class_Controller_Plugin extends vw_My_Class_Controller_Proxy
{
// extend stuff here
}
Say you want to add different versions for vBulletin, XenForo, etc that extend from your existing plugin. Create
vault/plugins/controller/my/class/vb3.php:
Code:
require_once(vw_Hard_Core::get_dir('plugin') . '/controller/my/class/vw.php');
class vw_My_Class_Controller_Plugin_vB3 extends vw_My_Class_Controller_Plugin
{
// extend even more here
}
Note that due to limitations in vBulletin 3 and 4, many classes are not available for extension all the time, because they might already loaded before vBulletin boots up. Examples include vw_Route_Controller, vw_User_Model, vw_Settings_Model, vw_Datastore_Model, vw_Start_Model, and more.
These limitations do not exist in XenForo.
However, regardless of forum platform, you cannot extend vw_Hard_Core, vw_Dependency_Model, or other classes that are instantiated outside of vw_Hard_Core::fetch_object.