Development

Changeset 13089

You must first sign up to be able to contribute.

Changeset 13089

Show
Ignore:
Timestamp:
11/18/08 00:18:18 (1 year ago)
Author:
fabien
Message:

[1.2] added a renderer option for the admin generator list (closes #685)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.2/lib/generator/sfModelGenerator.class.php

    r13060 r13089  
    248248    $html = $this->getColumnGetter($field->getName(), true); 
    249249 
    250     if ($field->isComponent()) 
     250    if ($renderer = $field->getRenderer()) 
     251    { 
     252      $html = sprintf("$html ? call_user_func_array(%s, array_merge(array(%s), %s)) : ' '", $this->asPhp($renderer), $html, $this->asPhp($field->getRendererArguments())); 
     253    } 
     254    else if ($field->isComponent()) 
    251255    { 
    252256      return sprintf("get_component('%s', '%s', array('type' => 'list', '%s' => \$%s))", $this->getModuleName(), $field->getName(), $this->getSingularName(), $this->getSingularName()); 
  • branches/1.2/lib/generator/sfModelGeneratorConfigurationField.class.php

    r12829 r13089  
    140140  } 
    141141 
     142  /** 
     143   * Sets the list renderer for the field. 
     144   * 
     145   * @param mixed A PHP callable 
     146   */ 
     147  public function setRenderer($renderer) 
     148  { 
     149    $this->config['renderer'] = $renderer; 
     150  } 
     151 
     152  /** 
     153   * Gets the list renderer for the field. 
     154   * 
     155   * @return mixed A PHP callable 
     156   */ 
     157  public function getRenderer() 
     158  { 
     159    return isset($this->config['renderer']) ? $this->config['renderer'] : null; 
     160  } 
     161 
     162  /** 
     163   * Sets the list renderer arguments for the field. 
     164   * 
     165   * @param array An array of arguments to pass to the renderer 
     166   */ 
     167  public function setRendererArguments(array $arguments) 
     168  { 
     169    $this->config['renderer_arguments'] = $arguments; 
     170  } 
     171 
     172  /** 
     173   * Gets the list renderer arguments for the field. 
     174   * 
     175   * @return array An array of arguments to pass to the renderer 
     176   */ 
     177  public function getRendererArguments() 
     178  { 
     179    return isset($this->config['renderer_arguments']) ? $this->config['renderer_arguments'] : array(); 
     180  } 
     181 
    142182  static public function splitFieldWithFlag($field) 
    143183  { 

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting.
Sensio Labs also supports several large Open-Source projects.