- md5
- 0904ccd8cdf7b70164d91cc191ef3b19
- sha1
- 1b333bf06b8248b18bae438cb6a526a06bb4f5ba
- sha256
- c9b7848c9bae1afcf89b9e6d3c53796a88dbc326c6e3148d56243ccf0d833b5d
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
<?php
/**
* Joomla! Content Management System
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\CMS\Form\Field;
defined('JPATH_PLATFORM') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Form\FormHelper;
FormHelper::loadFieldClass('text');
/**
* Form Field class for the Joomla Platform.
* Supports a URL text field
*
* @link http://www.w3.org/TR/html-markup/input.url.html#input.url
* @see JFormRuleUrl for validation of full urls
* @since 11.1
*/
class UrlField extends \JFormFieldText
{
/**
* The form field type.
*
* @var string
* @since 11.1
*/
protected $type = 'Url';
/**
* Name of the layout being used to render the field
*
* @var string
* @since 3.7
*/
protected $layout = 'joomla.form.field.url';
/**
* Method to get the field input markup.
*
* @return string The field input markup.
*
* @since 3.1.2 (CMS)
*/
protected function getInput()
{
// Trim the trailing line in the layout file
return rtrim($this->getRenderer($this->layout)->render($this->getLayoutData()), PHP_EOL);
}
/**
* Method to get the data to be passed to the layout for rendering.
*
* @return array
*
* @since 3.7
*/
protected function getLayoutData()
{
$data = parent::getLayoutData();
// Initialize some field attributes.
$maxLength = !empty($this->maxLength) ? ' maxlength="' . $this->maxLength . '"' : '';
// Note that the input type "url" is suitable only for external URLs, so if internal URLs are allowed
// we have to use the input type "text" instead.
$inputType = $this->element['relative'] ? 'type="text"' : 'type="url"';
$extraData = array(
'maxLength' => $maxLength,
'inputType' => $inputType,
);
return array_merge($data, $extraData);
}
}
No other release has this exact content. See every version of this file.