Dotclear


Ignore:
Timestamp:
08/21/13 15:33:12 (12 years ago)
Author:
Dsls
Branch:
twig
Message:

removed superfluous debug log
Added twig function "form_hidden" to display hidden fields where the user wants, instead of just before the end of form
(enables to be hxtml validator-friendly)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inc/admin/class.dc.form.php

    r1507 r1517  
    162162                    'form_field', 
    163163                    array($this,'renderField'), 
     164                    array('is_safe' => array('html')) 
     165               ), 
     166               new Twig_SimpleFunction( 
     167                    'form_hidden', 
     168                    array($this,'renderHiddenWidgets'), 
    164169                    array('is_safe' => array('html')) 
    165170               ), 
     
    299304          } 
    300305     } 
    301  
     306      
    302307    /** 
    303308     * getFieldAttributes - binding for 'form_field_attr' twig function; returns all field attributes 
     
    337342     */ 
    338343     public function renderHiddenWidgets() 
    339      { 
     344     {     
     345          if ($this->currentForm->areHiddenfieldsDisplayed()) { 
     346               return; 
     347          } 
    340348          foreach ($this->currentForm->getHiddenFields() as $h) { 
    341349               $this->renderField($h->getName()); 
    342350          } 
     351          $this->currentForm->setHiddenfieldsDisplayed(); 
    343352     } 
    344353 
     
    433442     protected $properties; 
    434443      
     444     protected $hiddendisplayed; 
    435445      
    436446    /** 
     
    461471               $this->addNonce(); 
    462472          } 
    463      } 
    464  
     473          $this->hiddendisplayed = false; 
     474     } 
     475 
     476     /** 
     477     * areHiddenFieldsDisplayed - tells whether hidden fields have been rendered or not 
     478     *  
     479     * @return boolean true if hidden fields have already been displayed, false otherwise 
     480     * @access public 
     481     */ 
     482     public function areHiddenFieldsDisplayed() { 
     483          return $this->hiddendisplayed; 
     484     } 
     485      
     486     /** 
     487     * setHiddenFieldsDisplayed - sets whether hidden fields have been rendered or not 
     488     *  
     489     * @param boolean true (default) if hidden fields are to be set as displayed, false otherwise 
     490     * @access public 
     491     */ 
     492     public function setHiddenFieldsDisplayed($value=true) { 
     493          $this->hiddendisplayed = $value; 
     494     } 
    465495      
    466496    /** 
Note: See TracChangeset for help on using the changeset viewer.

Sites map