1 <?php
2 /**
3 * @package Joomla.Platform
4 * @subpackage Form
5 *
6 * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
7 * @license GNU General Public License version 2 or later; see LICENSE
8 */
9
10 defined('JPATH_PLATFORM') or die;
11
12 JFormHelper::loadFieldClass('text');
13
14 /**
15 * Form Field class for the Joomla Platform.
16 * Provides and input field for email addresses
17 *
18 * @link http://www.w3.org/TR/html-markup/input.email.html#input.email
19 * @see JFormRuleEmail
20 * @since 11.1
21 */
22 class JFormFieldEMail extends JFormFieldText
23 {
24 /**
25 * The form field type.
26 *
27 * @var string
28 * @since 11.1
29 */
30 protected $type = 'Email';
31
32 /**
33 * Name of the layout being used to render the field
34 *
35 * @var string
36 * @since 3.7
37 */
38 protected $layout = 'joomla.form.field.email';
39
40 /**
41 * Method to get the field input markup for email addresses.
42 *
43 * @return string The field input markup.
44 *
45 * @since 11.1
46 */
47 protected function getInput()
48 {
49 // Trim the trailing line in the layout file
50 return rtrim($this->getRenderer($this->layout)->render($this->getLayoutData()), PHP_EOL);
51 }
52 /**
53 * Method to get the data to be passed to the layout for rendering.
54 *
55 * @return array
56 *
57 * @since 3.5
58 */
59 protected function getLayoutData()
60 {
61 $data = parent::getLayoutData();
62
63 $extraData = array(
64 'maxLength' => $this->maxLength,
65 'multiple' => $this->multiple,
66 );
67
68 return array_merge($data, $extraData);
69 }
70 }
71