* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved. * @license GNU General Public License version 3 or later; see LICENSE * * Text field with clickable placeholder pills that insert at cursor position. * Used for backup directory and archive name format fields. */ namespace Joomla\Component\MokoSuiteBackup\Administrator\Field; defined('_JEXEC') or die; use Joomla\CMS\Form\FormField; class PlaceholderTextField extends FormField { protected $type = 'PlaceholderText'; protected function getInput(): string { $value = htmlspecialchars($this->value ?? $this->default ?? '', ENT_QUOTES, 'UTF-8'); $id = htmlspecialchars($this->id, ENT_QUOTES, 'UTF-8'); $name = htmlspecialchars($this->name, ENT_QUOTES, 'UTF-8'); $hint = htmlspecialchars($this->element['hint'] ?? '', ENT_QUOTES, 'UTF-8'); $max = (int) ($this->element['maxlength'] ?? 512); $placeholderAttr = (string) ($this->element['placeholders'] ?? ''); $placeholders = array_filter(array_map('trim', explode(',', $placeholderAttr))); if (empty($placeholders)) { $placeholders = ['[HOST]', '[DATE]', '[DATETIME]', '[TIME]', '[YEAR]', '[MONTH]', '[DAY]', '[HOUR]', '[MINUTE]', '[SECOND]', '[PROFILE_ID]', '[PROFILE_NAME]', '[SITE_NAME]', '[TYPE]', '[RANDOM]']; } $html = ''; $html .= '