Jump to content

Custom Database Hook


IndianaJoe

Recommended Posts

Posted

Couple questions

1. Do I create a new file, if so where do I put it?

2. Where can I find the functions I can overwrite?

3. In 3.4.7 I did this, does the format of the file stay the same? Here is an example.

<?php
class database_callback_19   // rename this class to match the number of your IP.Content table
{   
		   
    public function __construct( $registry )
    {
        
    }
	
    public function postSave($newData) {

		blah blah blah
		return $newData;
	}
	
}
?>

Thanks

Posted

You create the file in the Developer Center - click the menu to the right of your application / plugin, then click Developer Center. You can create them under the Hooks tab.

As far as what methods can be overloaded - this is any method contained in the following classes, listed by inheritance order. The Developer Center will also show you this information if you edit the hook you just created.

  • \IPS\cms\RecordsX (this is a pseudo class created by an autoloader contained in /applications/cms/Application.php specific to the database, where X is the ID of that database)
  • \IPS\cms\Records (/applications/cms/sources/Records/Records.php)
  • \IPS\Content\Item (/system/Content/Item.php)
  • \IPS\Content (/system/Content/Content.php)
  • \IPS\Patterns\ActiveRecord (/system/Patterns/ActiveRecord.php)

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...