Example #1
0
 /**
  * Renderer driver factory
  *
  * Load and instantiate a renderer driver.
  * 
  * @access  private
  * @param   mixed   $source     The rendering container respective to the driver
  * @param   array   $options    An associative array of the form:
  *                              array(optionName => optionValue, ...)
  * @param   string  $type       The renderer type constant (of the form 
  *                              DATAGRID_RENDER_*)  
  * @uses    Structures_DataGrid_DataSource::_detectRendererType()     
  * @return  mixed               Returns the renderer driver object or 
  *                              PEAR_Error on failure
  */
 function &rendererFactory($type, $options = array())
 {
     $type = Structures_DataGrid::_correctDriverName($type, 'Renderer');
     if (PEAR::isError($type)) {
         return $type;
     }
     $className = "Structures_DataGrid_Renderer_{$type}";
     if (PEAR::isError($driver =& Structures_DataGrid::loadDriver($className))) {
         return $driver;
     }
     if ($options) {
         $driver->setOptions((array) $options);
     }
     return $driver;
 }