Hook for adding columns to grids via plugin


Hi there,

currently we have to override initFeatures of grid handlers to provide additional columns via a feature.#But this is only feasible when adding a new grid that news a separate handler.

I want to add columns via plugins so I added a hook in GridHandler::initFeatures()

protected function initFeatures($request, $args) {
$returner = array();
HookRegistry::call(strtolower_codesafe(get_class($this) . '::initFeatures'), array($this, $request, $args, &$returner));
return $returner;

Plugins can now register to that call and add columns via a grid feature as needed, for example:

HookRegistry::register('customformelementsgridhandler::initfeatures', array($this, 'customFormElementsGridHandlerInitFeatures'));

public function customFormElementsGridHandlerInitFeatures($hookName, $args)
	$returner =& $args[3];


	$returner[] = new CustomFormElementIdColumnGridFeature();

class CustomFormElementIdColumnGridFeature extends GridFeature {

	function __construct() {

	// Hooks implementation.
	 * @see GridFeature::gridInitialize()
	function gridInitialize($args) {
		$grid = $args['grid'];

		$grid->addColumn(new CustomFormElementIdGridColumn());


Can we integrate these changes into the official GitHub repo? Should i create an issue and provide a pull request?

So lonG


bump to get a response


Hi @j1shin,

In terms of broader infrastructure, we’re gradually moving away from the grids toolset into a new framework using vue.js; can you describe what part of the code you’re working with, e.g. what grid you’re augmenting?

Alec Smecher
Public Knowledge Project Team