[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/media/layouts/js/joomla/form/field/ -> category-change.js (source)

   1  /**
   2   * @copyright  (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
   3   * @license    GNU General Public License version 2 or later; see LICENSE.txt
   4   */
   5  (Joomla => {
   6    const id = Joomla.getOptions('category-change');
   7    const element = document.querySelector(`#$id}`);
   8  
   9    if (!element) {
  10      throw new Error('Category Id element not found');
  11    }
  12  
  13    if (element.getAttribute('data-refresh-catid') && element.value !== element.getAttribute('data-cat-id')) {
  14      element.value = element.getAttribute('data-refresh-catid');
  15    } else {
  16      // No custom fields
  17      element.setAttribute('data-refresh-catid', element.value);
  18    }
  19  
  20    window.Joomla.categoryHasChanged = el => {
  21      if (el.value === el.getAttribute('data-refresh-catid')) {
  22        return;
  23      }
  24  
  25      document.body.appendChild(document.createElement('joomla-core-loader')); // Custom Fields
  26  
  27      if (el.getAttribute('data-refresh-section')) {
  28        document.querySelector('input[name=task]').value = `$el.getAttribute('data-refresh-section')}.reload`;
  29      }
  30  
  31      Joomla.submitform(`$el.getAttribute('data-refresh-section')}.reload`, element.form);
  32    };
  33  })(Joomla);


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer