Create Terms@

This commit is contained in:
Llewellyn 2024-08-23 17:25:24 +00:00
parent f0393e83f7
commit 10268680b4

View File

@ -0,0 +1,116 @@
{
"name": "Terms@",
"short_description": "Joomla Terms Field",
"description": "Joomla Terms Field Type",
"properties": {
"properties0": {
"name": "type",
"example": "terms",
"mandatory": "1",
"description": "(mandatory) can be anything, just not the same as any other default Joomla field type. You can also not use the \"_\" (underscore) or \"-\" (hyphen) in the type name, and no spaces."
},
"properties1": {
"name": "name",
"example": "terms",
"adjustable": "1",
"mandatory": "1",
"description": "(mandatory) is the unique name of the field."
},
"properties2": {
"name": "label",
"example": "Terms & Conditions",
"adjustable": "1",
"mandatory": "1",
"translatable": "1",
"description": "(mandatory) (translatable) is the descriptive title of the field."
},
"properties3": {
"name": "description",
"example": "Read the full terms and conditions.",
"adjustable": "1",
"translatable": "1",
"description": "(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box."
},
"properties4": {
"name": "filter",
"example": "integer",
"adjustable": "1",
"description": "(optional) is a CSS class name for the HTML form field. If omitted this will default to 'inputbox'."
},
"properties5": {
"name": "option",
"example": "1|I agree,0|No",
"adjustable": "1",
"mandatory": "1",
"description": "(mandatory) set the options of this radio. Separate options with commas and use the pipe symbol to separate value from text."
},
"properties6": {
"name": "default",
"example": "0",
"adjustable": "1",
"description": "(optional) (not translatable) is the default value."
},
"properties7": {
"name": "required",
"example": "true",
"adjustable": "1",
"description": "(optional) The field must be filled before submitting the form."
},
"properties8": {
"name": "showon",
"example": "",
"adjustable": "1",
"description": "(optional) show this field on the bases of the value in another field. https:\/\/joomla.stackexchange.com\/a\/17682\/2166"
},
"properties9": {
"name": "onchange",
"example": "",
"adjustable": "1",
"description": "(optional) HTML equivalent attribute (javascript use)"
},
"properties10": {
"name": "extends",
"example": "radio",
"mandatory": "1",
"description": "Must be radio"
},
"properties11": {
"name": "type_phpHEADER_1",
"example": "use Joomla\\CMS\\Factory;\r\nuse Joomla\\CMS\\Form\\FormHelper;\r\nuse Joomla\\CMS\\Language\\Associations;\r\nuse Joomla\\CMS\\Language\\Text;",
"adjustable": "1",
"mandatory": "1",
"description": "The Header USE options"
},
"properties12": {
"name": "type_php_1",
"example": "\t\/**\r\n\t * Method to get the field input markup.\r\n\t *\r\n\t * @return string The field input markup.\r\n\t *\r\n\t * @since 3.9.0\r\n\t *\/\r\n\tprotected function getInput()\r\n\t{\r\n\t\t\/\/ Display the message before the field\r\n\t\techo $this->getRenderer('plugins.user.terms.message')->render($this->getLayoutData());\r\n\r\n\t\treturn parent::getInput();\r\n\t}",
"adjustable": "1",
"mandatory": "1",
"description": "The php for the getInput method."
},
"properties13": {
"name": "type_phpa_1",
"example": "\t\/**\r\n\t * Method to get the field label markup.\r\n\t *\r\n\t * @return string The field label markup.\r\n\t *\r\n\t * @since 3.9.0\r\n\t *\/\r\n\tprotected function getLabel()\r\n\t{\r\n\t\tif ($this->hidden)\r\n\t\t{\r\n\t\t\treturn '';\r\n\t\t}\r\n\r\n\t\treturn $this->getRenderer('plugins.user.terms.label')->render($this->getLayoutData());\r\n\t}",
"adjustable": "1",
"mandatory": "1",
"description": "The php for the getLabel method."
},
"properties14": {
"name": "type_phpb_1",
"example": "\t\/**\r\n\t * Method to get the data to be passed to the layout for rendering.\r\n\t *\r\n\t * @return array\r\n\t *\r\n\t * @since 3.9.4\r\n\t *\/\r\n\tprotected function getLayoutData()\r\n\t{\r\n\t\t$data = parent::getLayoutData();\r\n\r\n\t\t$article = false;\r\n\t\t$termsArticle = $this->element['article'] > 0 ? (int) $this->element['article'] : 0;\r\n\r\n\t\tif ($termsArticle && Factory::getApplication()->isClient('site'))\r\n\t\t{\r\n\t\t\t$db = Factory::getDbo();\r\n\t\t\t$query = $db->getQuery(true)\r\n\t\t\t\t->select($db->quoteName(array('id', 'alias', 'catid', 'language')))\r\n\t\t\t\t->from($db->quoteName('#__content'))\r\n\t\t\t\t->where($db->quoteName('id') . ' = ' . (int) $termsArticle);\r\n\t\t\t$db->setQuery($query);\r\n\t\t\t$article = $db->loadObject();\r\n\r\n\t\t\tJLoader::register('ContentHelperRoute', JPATH_BASE . '\/components\/com_content\/helpers\/route.php');\r\n\r\n\t\t\tif (Associations::isEnabled())\r\n\t\t\t{\r\n\t\t\t\t$termsAssociated = Associations::getAssociations('com_content', '#__content', 'com_content.item', $termsArticle);\r\n\t\t\t}\r\n\r\n\t\t\t$currentLang = Factory::getLanguage()->getTag();\r\n\r\n\t\t\tif (isset($termsAssociated) && $currentLang !== $article->language && array_key_exists($currentLang, $termsAssociated))\r\n\t\t\t{\r\n\t\t\t\t$article->link = ContentHelperRoute::getArticleRoute(\r\n\t\t\t\t\t$termsAssociated[$currentLang]->id,\r\n\t\t\t\t\t$termsAssociated[$currentLang]->catid,\r\n\t\t\t\t\t$termsAssociated[$currentLang]->language\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t$slug = $article->alias ? ($article->id . ':' . $article->alias) : $article->id;\r\n\t\t\t\t$article->link = ContentHelperRoute::getArticleRoute($slug, $article->catid, $article->language);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t$extraData = array(\r\n\t\t\t'termsnote' => !empty($this->element['note']) ? $this->element['note'] : Text::_('By signing up to this web site you accept the Terms & Conditions.'),\r\n\t\t\t'options' => $this->getOptions(),\r\n\t\t\t'value' => (string) $this->value,\r\n\t\t\t'translateLabel' => $this->translateLabel,\r\n\t\t\t'translateDescription' => $this->translateDescription,\r\n\t\t\t'translateHint' => $this->translateHint,\r\n\t\t\t'termsArticle' => $termsArticle,\r\n\t\t\t'article' => $article,\r\n\t\t);\r\n\r\n\t\treturn array_merge($data, $extraData);\r\n\t}",
"adjustable": "1",
"mandatory": "1",
"description": "The php for the getLayoutData method."
}
},
"has_defaults": "0",
"datatype": "",
"datalenght": "",
"datalenght_other": "",
"datadefault": "",
"datadefault_other": "",
"indexes": "0",
"null_switch": "NOT NULL",
"store": "0",
"guid": "20e88943-08db-49e6-a571-dba70cdf4cca"
}