Jump to content

Developer Documentation

Node controllers

When creating admin controllers designed to work with a particular node model (for example, the forum manager screen in the Forums app), IPS4 provides a special node controller you can extend to get a lot of automatic functionality, instead of building it yourself manually. This controller provides an interface for viewing and managing nodes (adding, editing, reordering etc.)

\IPS\Node\Controller itself extend \IPS\Dispatcher\Controller, so all of the standard controller methods are still available to you.

 

Using \IPS\Node\Controller

The only requirement to use the node controller is to add a $nodeClass property to your model which defines the class that your model uses:

namespace \IPS\yourApp\modules\front\yourModule;

class _yourController extends \IPS\Node\Controller
{
	/**
	 * @brief	Has been CSRF-protected
	 */
	public static $csrfProtected = TRUE;

	protected $nodeClass = 'IPS\yourApp\YourModelClass';

	// ... Your controller methods and properties
}

No other methods are required in this controller (although you can add other request handlers if desired); the bulk of its functionality is automatic.

 

Please see Security Considerations for further information about the csrf protection.


  Report Document


×
×
  • Create New...