[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/src/Form/Field/ -> EmailField.php (source)

   1  <?php
   2  
   3  /**
   4   * Joomla! Content Management System
   5   *
   6   * @copyright  (C) 2011 Open Source Matters, Inc. <https://www.joomla.org>
   7   * @license    GNU General Public License version 2 or later; see LICENSE.txt
   8   */
   9  
  10  namespace Joomla\CMS\Form\Field;
  11  
  12  // phpcs:disable PSR1.Files.SideEffects
  13  \defined('JPATH_PLATFORM') or die;
  14  // phpcs:enable PSR1.Files.SideEffects
  15  
  16  /**
  17   * Form Field class for the Joomla Platform.
  18   * Provides and input field for email addresses
  19   *
  20   * @link   https://html.spec.whatwg.org/multipage/input.html#email-state-(type=email)
  21   * @see    \Joomla\CMS\Form\Rule\EmailRule
  22   * @since  1.7.0
  23   */
  24  class EmailField extends TextField
  25  {
  26      /**
  27       * The form field type.
  28       *
  29       * @var    string
  30       * @since  1.7.0
  31       */
  32      protected $type = 'Email';
  33  
  34      /**
  35       * Name of the layout being used to render the field
  36       *
  37       * @var    string
  38       * @since  3.7
  39       */
  40      protected $layout = 'joomla.form.field.email';
  41  
  42      /**
  43       * Method to get the field input markup for email addresses.
  44       *
  45       * @return  string  The field input markup.
  46       *
  47       * @since   1.7.0
  48       */
  49      protected function getInput()
  50      {
  51          // Trim the trailing line in the layout file
  52          return rtrim($this->getRenderer($this->layout)->render($this->getLayoutData()), PHP_EOL);
  53      }
  54      /**
  55       * Method to get the data to be passed to the layout for rendering.
  56       *
  57       * @return  array
  58       *
  59       * @since 3.5
  60       */
  61      protected function getLayoutData()
  62      {
  63          $data = parent::getLayoutData();
  64  
  65          $extraData = array(
  66              'maxLength'  => $this->maxLength,
  67              'multiple'   => $this->multiple,
  68          );
  69  
  70          return array_merge($data, $extraData);
  71      }
  72  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer