_actionArgs = $actionArgs; $cellProvider = new ColumnBasedGridCellProvider(); parent::__construct( 'name', 'common.name', null, null, $cellProvider, ['width' => 60, 'alignment' => GridColumn::COLUMN_ALIGNMENT_LEFT] ); } // // Public methods // /** * Method expected by ColumnBasedGridCellProvider * to render a cell in this column. * * @copydoc ColumnBasedGridCellProvider::getTemplateVarsFromRowColumn() */ public function getTemplateVarsFromRow($row) { // We do not need any template variables because // the only content of this column's cell will be // an action. See QueryTitleGridColumn::getCellActions(). return ['label' => '']; } // // Override methods from GridColumn // /** * @copydoc GridColumn::getCellActions() */ public function getCellActions($request, $row, $position = GridHandler::GRID_ACTION_POSITION_DEFAULT) { // Retrieve the submission file. $query = $row->getData(); $headNote = $query->getHeadNote(); // Create the cell action to download a file. $router = $request->getRouter(); $actionArgs = array_merge( $this->_actionArgs, ['queryId' => $query->getId()] ); return array_merge( parent::getCellActions($request, $row, $position), [ new LinkAction( 'readQuery', new AjaxModal( $router->url($request, null, null, 'readQuery', null, $actionArgs), $headNote ? htmlspecialchars($headNote->getTitle()) : '—', 'modal_edit' ), ($headNote && $headNote->getTitle() != '') ? htmlspecialchars($headNote->getTitle()) : '—', null ) ] ); } }