diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000000000..0be9be57ae051 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +custom: https://community.joomla.org/sponsorship-campaigns.html diff --git a/administrator/components/com_associations/View/Association/HtmlView.php b/administrator/components/com_associations/View/Association/HtmlView.php index f1a412e22553d..a2eb8f6c5878a 100644 --- a/administrator/components/com_associations/View/Association/HtmlView.php +++ b/administrator/components/com_associations/View/Association/HtmlView.php @@ -118,8 +118,9 @@ public function display($tpl = null) $referenceId = $input->get('id', 0, 'int'); $reference = ArrayHelper::fromObject(AssociationsHelper::getItem($extensionName, $typeName, $referenceId)); - $this->referenceLanguage = $reference[$languageField]; - $this->referenceTitle = AssociationsHelper::getTypeFieldName($extensionName, $typeName, 'title'); + $this->referenceLanguage = $reference[$languageField]; + $this->referenceTitle = AssociationsHelper::getTypeFieldName($extensionName, $typeName, 'title'); + $this->referenceTitleValue = $reference[$this->referenceTitle]; // Check for special case category $typeNameExploded = explode('.', $typeName); diff --git a/administrator/components/com_associations/tmpl/association/edit.php b/administrator/components/com_associations/tmpl/association/edit.php index 34d948ca05bc4..aca22cdafc274 100644 --- a/administrator/components/com_associations/tmpl/association/edit.php +++ b/administrator/components/com_associations/tmpl/association/edit.php @@ -44,6 +44,7 @@ data-item="typeName; ?>" data-id="referenceId; ?>" data-title="referenceTitle; ?>" + data-title-value="referenceTitleValue; ?>" data-language="referenceLanguage; ?>" data-editurl="editUri); ?>"> diff --git a/administrator/components/com_banners/Model/BannerModel.php b/administrator/components/com_banners/Model/BannerModel.php index e056a05cd7aae..20293e4d7e58b 100644 --- a/administrator/components/com_banners/Model/BannerModel.php +++ b/administrator/components/com_banners/Model/BannerModel.php @@ -373,6 +373,9 @@ protected function preprocessForm(Form $form, $data, $group = 'content') if ($this->canCreateCategory()) { $form->setFieldAttribute('catid', 'allowAdd', 'true'); + + // Add a prefix for categories created on the fly. + $form->setFieldAttribute('catid', 'customPrefix', '#new#'); } parent::preprocessForm($form, $data, $group); @@ -391,20 +394,22 @@ public function save($data) { $input = Factory::getApplication()->input; - // Cast catid to integer for comparison - $catid = (int) $data['catid']; + // Create new category, if needed. + $createCategory = true; - // Check if New Category exists - if ($catid > 0) + // If category ID is provided, check if it's valid. + if (is_numeric($data['catid']) && $data['catid']) { - $catid = CategoriesHelper::validateCategoryId($data['catid'], 'com_banners'); + $createCategory = !CategoriesHelper::validateCategoryId($data['catid'], 'com_banners'); } // Save New Category - if ($catid == 0 && $this->canCreateCategory()) + if ($createCategory && $this->canCreateCategory()) { $table = array(); - $table['title'] = $data['catid']; + + // Remove #new# prefix, if exists. + $table['title'] = strpos($data['catid'], '#new#') === 0 ? substr($data['catid'], 5) : $data['catid']; $table['parent_id'] = 1; $table['extension'] = 'com_banners'; $table['language'] = $data['language']; diff --git a/administrator/components/com_categories/Field/CategoryeditField.php b/administrator/components/com_categories/Field/CategoryeditField.php index 5042baab34949..e75a578231912 100644 --- a/administrator/components/com_categories/Field/CategoryeditField.php +++ b/administrator/components/com_categories/Field/CategoryeditField.php @@ -32,6 +32,14 @@ class CategoryeditField extends ListField */ protected $allowAdd; + /** + * Optional prefix for new categories. + * + * @var string + * @since 3.9.11 + */ + protected $customPrefix; + /** * A flexible category list that respects access controls * @@ -69,6 +77,7 @@ public function setup(\SimpleXMLElement $element, $value, $group = null) if ($return) { $this->allowAdd = isset($this->element['allowAdd']) ? (boolean) $this->element['allowAdd'] : false; + $this->customPrefix = (string) $this->element['customPrefix']; } return $return; @@ -89,6 +98,8 @@ public function __get($name) { case 'allowAdd': return (bool) $this->$name; + case 'customPrefix': + return $this->$name; } return parent::__get($name); @@ -114,6 +125,9 @@ public function __set($name, $value) $value = (string) $value; $this->$name = ($value === 'true' || $value === $name || $value === '1'); break; + case 'customPrefix': + $this->$name = (string) $value; + break; default: parent::__set($name, $value); } diff --git a/administrator/components/com_categories/layouts/joomla/form/field/categoryedit.php b/administrator/components/com_categories/layouts/joomla/form/field/categoryedit.php index 7e2f99159d38d..2645a45de6136 100644 --- a/administrator/components/com_categories/layouts/joomla/form/field/categoryedit.php +++ b/administrator/components/com_categories/layouts/joomla/form/field/categoryedit.php @@ -71,6 +71,11 @@ if ($allowCustom) { $attr2 .= ' allow-custom'; + + if ($this->customPrefix !== '') + { + $attr2 .= ' data-custom_value_prefix="' . $this->customPrefix . '" '; + } } if ($required) diff --git a/administrator/components/com_contact/Model/ContactModel.php b/administrator/components/com_contact/Model/ContactModel.php index 59c04ea0f507e..d4ebf420ac711 100644 --- a/administrator/components/com_contact/Model/ContactModel.php +++ b/administrator/components/com_contact/Model/ContactModel.php @@ -278,20 +278,22 @@ public function save($data) { $input = Factory::getApplication()->input; - // Cast catid to integer for comparison - $catid = (int) $data['catid']; + // Create new category, if needed. + $createCategory = true; - // Check if New Category exists - if ($catid > 0) + // If category ID is provided, check if it's valid. + if (is_numeric($data['catid']) && $data['catid']) { - $catid = CategoriesHelper::validateCategoryId($data['catid'], 'com_contact'); + $createCategory = !CategoriesHelper::validateCategoryId($data['catid'], 'com_contact'); } // Save New Category - if ($catid == 0 && $this->canCreateCategory()) + if ($createCategory && $this->canCreateCategory()) { $table = array(); - $table['title'] = $data['catid']; + + // Remove #new# prefix, if exists. + $table['title'] = strpos($data['catid'], '#new#') === 0 ? substr($data['catid'], 5) : $data['catid']; $table['parent_id'] = 1; $table['extension'] = 'com_contact'; $table['language'] = $data['language']; @@ -427,6 +429,9 @@ protected function preprocessForm(Form $form, $data, $group = 'content') if ($this->canCreateCategory()) { $form->setFieldAttribute('catid', 'allowAdd', 'true'); + + // Add a prefix for categories created on the fly. + $form->setFieldAttribute('catid', 'customPrefix', '#new#'); } // Association contact items diff --git a/administrator/components/com_contact/tmpl/contacts/modal.php b/administrator/components/com_contact/tmpl/contacts/modal.php index 86b7424b5ef82..e1fa25cc5135f 100644 --- a/administrator/components/com_contact/tmpl/contacts/modal.php +++ b/administrator/components/com_contact/tmpl/contacts/modal.php @@ -44,7 +44,7 @@ ?>