render() public method

To be used by a GridRow to generate a rendered representation of the element for the given column.
public render ( $request, $row, $column ) : string
$row GridRow
$column GridColumn
return string the rendered representation of the element for the given column
 /**
  * @see GridCellProvider::render()
  */
 function render($request, $row, $column)
 {
     // Default category rows will only have the first column
     // as label columns.
     if ($column->hasFlag('firstColumn')) {
         // Store the current column template.
         $template = $column->getTemplate();
         // Reset to the default column template.
         $column->setTemplate('controllers/grid/gridCell.tpl');
         // Render the cell.
         $renderedCell = parent::render($request, $row, $column);
         // Restore the original column template.
         $column->setTemplate($template);
         return $renderedCell;
     } else {
         return '';
     }
 }
示例#2
0
 /**
  * Method that renders a cell.
  *
  * NB: You must have initialized the row
  * before you call this method.
  *
  * @param $request PKPRequest
  * @param $row GridRow
  * @param $column GridColumn
  * @return string the cell HTML
  */
 private function _renderCellInternally($request, $row, $column)
 {
     // If there is no object, then we want to return an empty row.
     // override the assigned GridCellProvider and provide the default.
     $element =& $row->getData();
     if (is_null($element) && $row->getIsModified()) {
         import('lib.pkp.classes.controllers.grid.GridCellProvider');
         $cellProvider = new GridCellProvider();
         return $cellProvider->render($request, $row, $column);
     }
     // Otherwise, get the cell content.
     // If row defines a cell provider, use it.
     $cellProvider = $row->getCellProvider();
     if (!is_a($cellProvider, 'GridCellProvider')) {
         // Remove reference to the row variable.
         unset($cellProvider);
         // Get cell provider from column.
         $cellProvider = $column->getCellProvider();
     }
     return $cellProvider->render($request, $row, $column);
 }