Server : LiteSpeed System : Linux server 3.10.0-1160.90.1.el7.x86_64 #1 SMP Thu May 4 15:21:22 UTC 2023 x86_64 User : alsaif ( 1057) PHP Version : 7.4.33 Disable Function : show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/alsaif/domains/alsaif.group/public_html/plugins/fields/acfurl/fields/ |
<?php
/**
* @author Tassos.gr <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2019 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Form\FormField;
use Joomla\CMS\Form\Form;
class JFormFieldUrlAdvanced extends FormField
{
/**
* Method to attach a JForm object to the field.
*
* @param SimpleXMLElement $element The SimpleXMLElement object representing the <field /> tag for the form field object.
* @param mixed $value The form field value to validate.
* @param string $group The field name group control value.
*
* @return boolean True on success.
*
* @since 3.6
*/
public function setup(SimpleXMLElement $element, $value, $group = null)
{
if (!parent::setup($element, $value, $group))
{
return false;
}
if ($this->value && is_string($this->value))
{
// Guess here is the JSON string from 'default' attribute
$this->value = json_decode($this->value, true);
}
return true;
}
protected function getInput()
{
$form_source = new SimpleXMLElement('
<form>
<fieldset name="url">
<field name="text" type="text"
label="ACF_URL_TEXT"
description="ACF_URL_TEXT_DESC"
class="w-100"
hint="ACF_URL_TEXT_DESC"
required="' . $this->required . '"
disabled="' . $this->disabled . '"
/>
<field name="url" type="url"
label="NR_URL"
description="ACF_URL_VALUE_DESC"
class="w-100"
hint="ACF_URL_VALUE_DESC"
required="' . $this->required . '"
disabled="' . $this->disabled . '"
/>
<field name="target" type="list"
label="ACF_URL_TARGET"
description="ACF_URL_TARGET_DESC"
required="' . $this->required . '"
disabled="' . $this->disabled . '">
<option value="same_tab">ACF_URL_TARGET_SAME_TAB</option>
<option value="new_tab">ACF_URL_TARGET_NEW_TAB</option>
<option value="popup">ACF_URL_TARGET_POPUP</option>
</field>
</fieldset>
</form>
');
$control = $this->name;
$formname = 'urladvanced.' . str_replace(['jform[', '[', ']'], ['', '.', ''], $control);
$form = Form::getInstance($formname, $form_source->asXML(), ['control' => $control]);
$form->bind($this->value);
return $form->renderFieldset('url');
}
}