Development

Changeset 8138

You must first sign up to be able to contribute.

Changeset 8138

Show
Ignore:
Timestamp:
03/28/08 17:21:34 (1 year ago)
Author:
fabien
Message:

removed action template variable availability from the layout

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/UPGRADE

    r7963 r8138  
    562562factory, not only the `sfFileCache`. 
    563563 
     564Layout 
     565------ 
     566 
     567The action template variables are not available anymore in the layout. This means that the layout 
     568only has access to **global** variables (all `sf_` variables) and variables registered via the 
     569`template.filter_parameters` event. 
     570 
     571Refer to this wiki page for more information on how to upgrade: 
     572 
     573    http://trac.symfony-project.com/wiki/Symfony11LayoutUpgrade 
     574 
    564575NOTE to early adopters 
    565576---------------------- 
  • branches/1.1/lib/view/sfPHPView.class.php

    r7967 r8138  
    112112 
    113113  /** 
    114    * Loop through all template slots and fill them in with the results of 
    115    * presentation data. 
     114   * Loop through all template slots and fill them in with the results of presentation data. 
    116115   * 
    117    * @param string A chunk of decorator content 
     116   * @param string A chunk of decorator content 
    118117   * 
    119118   * @return string A decorated template 
     
    127126 
    128127    // set the decorator content as an attribute 
    129     $this->attributeHolder->set('sf_content', $content); 
     128    $attributeHolder = $this->attributeHolder; 
     129 
     130    $this->attributeHolder = $this->initializeAttributeHolder(array('sf_content' => $content)); 
    130131 
    131132    // render the decorator template and return the result 
    132     return $this->renderFile($this->getDecoratorDirectory().'/'.$this->getDecoratorTemplate()); 
     133    $ret = $this->renderFile($this->getDecoratorDirectory().'/'.$this->getDecoratorTemplate()); 
     134 
     135    $this->attributeHolder = $attributeHolder; 
     136 
     137    return $ret; 
    133138  } 
    134139 
     
    146151      $uri = $this->context->getRouting()->getCurrentInternalUri(); 
    147152 
    148       list($content, $attributeHolder, $decoratorTemplate) = $viewCache->getActionCache($uri); 
     153      list($content, $decoratorTemplate) = $viewCache->getActionCache($uri); 
    149154      if (!is_null($content)) 
    150155      { 
    151         $this->attributeHolder = $attributeHolder; 
    152156        $this->setDecoratorTemplate($decoratorTemplate); 
    153157      } 
     
    165169      if (sfConfig::get('sf_cache')) 
    166170      { 
    167         $content = $viewCache->setActionCache($uri, $content, $this->attributeHolder, $this->isDecorator() ? $this->getDecoratorDirectory().'/'.$this->getDecoratorTemplate() : false); 
     171        $content = $viewCache->setActionCache($uri, $content, $this->isDecorator() ? $this->getDecoratorDirectory().'/'.$this->getDecoratorTemplate() : false); 
    168172      } 
    169173    } 
  • branches/1.1/lib/view/sfView.class.php

    r8083 r8138  
    120120    sfOutputEscaper::markClassAsSafe('sfForm'); 
    121121 
    122     $this->attributeHolder = false === sfConfig::get('sf_escaping_method') ? new sfViewParameterHolder() : new sfEscapedViewParameterHolder(); 
    123     $this->attributeHolder->initialize($this->dispatcher, array(), array( 
     122    $this->attributeHolder = $this->initializeAttributeHolder(); 
     123 
     124    $this->parameterHolder = new sfParameterHolder(); 
     125    $this->parameterHolder->add(sfConfig::get('mod_'.strtolower($moduleName).'_view_param', array())); 
     126 
     127    // include view configuration 
     128    $this->configure(); 
     129 
     130    return true; 
     131  } 
     132 
     133  protected function initializeAttributeHolder($attributes = array()) 
     134  { 
     135    $attributeHolder = false === sfConfig::get('sf_escaping_method') ? new sfViewParameterHolder() : new sfEscapedViewParameterHolder(); 
     136    $attributeHolder->initialize($this->dispatcher, $attributes, array( 
    124137      'escaping_method'   => sfConfig::get('sf_escaping_method'), 
    125138      'escaping_strategy' => sfConfig::get('sf_escaping_strategy'), 
    126139    )); 
    127140 
    128     $this->parameterHolder = new sfParameterHolder(); 
    129     $this->parameterHolder->add(sfConfig::get('mod_'.strtolower($moduleName).'_view_param', array())); 
    130  
    131     // include view configuration 
    132     $this->configure(); 
    133  
    134     return true; 
     141    return $attributeHolder; 
    135142  } 
    136143 
  • branches/1.1/lib/view/sfViewCacheManager.class.php

    r8095 r8138  
    747747    } 
    748748 
    749     return array($content, $cache['attributeHolder'], $cache['decoratorTemplate']); 
     749    return array($content, $cache['decoratorTemplate']); 
    750750  } 
    751751 
     
    759759   * @return string The cached content 
    760760   */ 
    761   public function setActionCache($uri, $content, $attributeHolder, $decoratorTemplate) 
     761  public function setActionCache($uri, $content, $decoratorTemplate) 
    762762  { 
    763763    if (!$this->isCacheable($uri) || $this->withLayout($uri)) 
     
    766766    } 
    767767 
    768     $saved = $this->set(serialize(array('content' => $content, 'attributeHolder' => $attributeHolder, 'decoratorTemplate' => $decoratorTemplate, 'response' => $this->context->getResponse())), $uri); 
     768    $saved = $this->set(serialize(array('content' => $content, 'decoratorTemplate' => $decoratorTemplate, 'response' => $this->context->getResponse())), $uri); 
    769769 
    770770    if ($saved && sfConfig::get('sf_web_debug')) 

The Sensio Labs Network

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