Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.
   1  <?php
   2  /* vim: set expandtab tabstop=4 shiftwidth=4: */
   3  // +----------------------------------------------------------------------+
   4  // | PHP version 4.0                                                      |
   5  // +----------------------------------------------------------------------+
   6  // | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group             |
   7  // +----------------------------------------------------------------------+
   8  // | This source file is subject to version 2.0 of the PHP license,       |
   9  // | that is bundled with this package in the file LICENSE, and is        |
  10  // | available at through the world-wide-web at                           |
  11  // | http://www.php.net/license/2_02.txt.                                 |
  12  // | If you did not receive a copy of the PHP license and are unable to   |
  13  // | obtain it through the world-wide-web, please send a note to          |
  14  // | license@php.net so we can mail you a copy immediately.               |
  15  // +----------------------------------------------------------------------+
  16  // | Authors: Adam Daniel <adaniel1@eesus.jnj.com>                        |
  17  // |          Bertrand Mansion <bmansion@mamasam.com>                     |
  18  // +----------------------------------------------------------------------+
  19  //
  20  // $Id$
  21  
  22  require_once("HTML/QuickForm/input.php");
  23  
  24  /**
  25   * HTML class for a hidden type element
  26   *
  27   * @author       Adam Daniel <adaniel1@eesus.jnj.com>
  28   * @author       Bertrand Mansion <bmansion@mamasam.com>
  29   * @version      1.0
  30   * @since        PHP4.04pl1
  31   * @access       public
  32   */
  33  class HTML_QuickForm_hidden extends HTML_QuickForm_input
  34  {
  35      // {{{ constructor
  36  
  37      /**
  38       * Class constructor
  39       *
  40       * @param     string    $elementName    (optional)Input field name attribute
  41       * @param     string    $value          (optional)Input field value
  42       * @param     mixed     $attributes     (optional)Either a typical HTML attribute string
  43       *                                      or an associative array
  44       * @since     1.0
  45       * @access    public
  46       * @return    void
  47       */
  48      public function __construct($elementName=null, $value='', $attributes=null) {
  49          parent::__construct($elementName, null, $attributes);
  50          $this->setType('hidden');
  51          $this->setValue($value);
  52      } //end constructor
  53  
  54      /**
  55       * Old syntax of class constructor. Deprecated in PHP7.
  56       *
  57       * @deprecated since Moodle 3.1
  58       */
  59      public function HTML_QuickForm_hidden($elementName=null, $value='', $attributes=null) {
  60          debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
  61          return self::__construct($elementName, $value, $attributes);
  62      }
  63  
  64      // }}}
  65      // {{{ freeze()
  66  
  67      /**
  68       * Freeze the element so that only its value is returned
  69       *
  70       * @access    public
  71       * @return    void
  72       */
  73      function freeze()
  74      {
  75          return false;
  76      } //end func freeze
  77  
  78      // }}}
  79      // {{{ accept()
  80  
  81     /**
  82      * Accepts a renderer
  83      *
  84      * @param object     An HTML_QuickForm_Renderer object
  85      * @access public
  86      * @return void
  87      */
  88      function accept(&$renderer, $required=false, $error=null)
  89      {
  90          $renderer->renderHidden($this);
  91      } // end func accept
  92  
  93      // }}}
  94  
  95  } //end class HTML_QuickForm_hidden
  96  ?>