This commit is contained in:
2024-12-31 11:07:09 +01:00
parent df7915205d
commit e089172b15
1916 changed files with 165422 additions and 271 deletions

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fields name="params">
<fieldset name="conditions" label="NR_PUBLISHING_ASSIGNMENTS" addfieldpath="plugins/system/nrframework/fields">
<field name="rules" type="ConditionBuilder"
label="NR_PUBLISHING_ASSIGNMENTS"
hiddenLabel="true"
/>
</fieldset>
</fields>
</form>

View File

@ -0,0 +1,119 @@
<?php
/**
* @package Advanced Custom Fields
* @version 2.8.8 Pro
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2023 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\Field\ListField;
use \NRFramework\Widgets\Helper;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
class JFormFieldACFFieldLayoutOverrides extends ListField
{
/**
* Method to get a list of options for a list input.
*
* @return array An array of options.
*/
protected function getOptions()
{
$layouts = [
'default' => 'JOPTION_USE_DEFAULT'
];
$field_type = (string) $this->element['field_type'];
$field_widget_name = (string) $this->element['widget_name'];
$override_widget_directory_name = $this->getOverrideWidgetDirectoryName($field_widget_name, $field_type);
if ($layout_overrides = Helper::getLayoutOverrides($override_widget_directory_name))
{
$layouts = array_merge($layouts, $layout_overrides);
}
foreach ($layouts as $key => $title)
{
$options[] = HTMLHelper::_('select.option', $key, Text::_($title));
}
return $options;
}
public function getInput()
{
$field_type = (string) $this->element['field_type'];
$field_widget_name = (string) $this->element['widget_name'];
$override_widget_directory_name = $this->getOverrideWidgetDirectoryName($field_widget_name, $field_type);
if (!$override_widget_directory_name)
{
return Text::_('ACF_OVERRIDE_WIDGET_LAYOUT_PLEASE_SAVE_FIRST');
}
$original_path = implode(DIRECTORY_SEPARATOR, [JPATH_PLUGINS, 'system', 'nrframework', 'layouts', 'widgets', $override_widget_directory_name]). '/default.php';
$new_path = Helper::getLayoutOverridePath($override_widget_directory_name) . '/LAYOUTNAME.php';
$note = '<div class="acf-field-setting-note" style="padding-top:5px;">' . sprintf(Text::_('ACF_OVERRIDE_WIDGET_BASED_FIELD_LAYOUT_DESC'), Text::_('PLG_FIELDS_ACF' . $this->getHelpName($field_widget_name, $field_type) . '_LABEL'), $original_path, $new_path) . '</div>';
return parent::getInput() . $note;
}
/**
* Some widgets require a different directory to be used for layout overrides.
*
* @param string $field_widget_name The widget name
* @param string $field_type The field type
*
* @return string
*/
private function getOverrideWidgetDirectoryName($field_widget_name = null, $field_type = null)
{
if (!$field_widget_name || !$field_type)
{
return;
}
switch ($field_type)
{
case 'acfvideo':
$field_widget_name = strtolower($this->form->getData()->get('fieldparams.provider', ''));
break;
case 'acfgallery':
if ($this->form->getData()->get('fieldparams.style', '') === 'slideshow')
{
$field_widget_name = 'slideshow';
}
break;
}
return strtolower($field_widget_name);
}
private function getHelpName($field_widget_name = null, $field_type = null)
{
if (!$field_widget_name || !$field_type)
{
return;
}
switch ($field_type)
{
case 'acfaddress':
$field_widget_name = 'Address';
break;
case 'acfmap':
$field_widget_name = 'Map';
break;
}
return strtoupper($field_widget_name);
}
}

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fields name="params">
<fieldset name="acf_options" label="ACF_ACF_OPTIONS">
<field name="acf_custom_css" type="editor"
label="ACF_CUSTOM_CSS"
description="ACF_CUSTOM_CSS_DESC"
editor="codemirror"
filter="raw"
/>
<field name="acf_layout_override" type="ACFFieldLayoutOverrides"
label="ACF_WIDGET_LAYOUT"
description="ACF_FIELD_LAYOUT_OVERRIDES"
/>
</fieldset>
</fields>
</form>

View File

@ -0,0 +1,63 @@
<?php
/**
* @package Advanced Custom Fields
* @version 2.8.8 Pro
*
* @author Tassos Marinos <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
*/
use Joomla\CMS\Form\FormRule;
defined('_JEXEC') or die('Restricted access');
use Joomla\String\StringHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
class JFormRuleACFGravatarValidator extends FormRule
{
/**
* Method to test the calendar value for a valid parts.
*
* @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. This acts as an array container for the field.
* For example if the field has name="foo" and the group value is set to "bar" then the
* full field name would end up being "bar[foo]".
* @param Registry $input An optional Registry object with the entire data set to validate against the entire form.
* @param Form $form The form object for which the field is being tested.
*
* @return boolean True if the value is valid, false otherwise.
*
* @since 3.7.0
*/
public function test(SimpleXMLElement $element, $value, $group = null, \Joomla\Registry\Registry $input = NULL, \Joomla\CMS\Form\Form $form = NULL)
{
// If the field is empty and not required, the field is valid.
$required = ((string) $element['required'] == 'true' || (string) $element['required'] == 'required');
if (!$required && empty($value))
{
return true;
}
// Allow Smile Pack Smart Tags
if (StringHelper::strpos($value, '{sp') !== false)
{
return true;
}
// Validate email
if (filter_var($value, FILTER_VALIDATE_EMAIL))
{
return true;
}
Factory::getApplication()->enqueueMessage(Text::_('ACF_INVALID_EMAIL'), 'error');
return false;
}
}

View File

@ -0,0 +1,56 @@
<?php
/**
* @package Advanced Custom Fields
* @version 2.8.8 Pro
*
* @author Tassos Marinos <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
*/
use Joomla\CMS\Form\FormRule;
defined('_JEXEC') or die('Restricted access');
/**
* Form Rule class for the Joomla Platform.
*
* @since 1.7.0
*/
class JFormRuleACFRequired extends FormRule
{
/**
* Method to test the calendar value for a valid parts.
*
* @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. This acts as an array container for the field.
* For example if the field has name="foo" and the group value is set to "bar" then the
* full field name would end up being "bar[foo]".
* @param Registry $input An optional Registry object with the entire data set to validate against the entire form.
* @param Form $form The form object for which the field is being tested.
*
* @return boolean True if the value is valid, false otherwise.
*
* @since 3.7.0
*/
public function test(SimpleXMLElement $element, $value, $group = null, \Joomla\Registry\Registry $input = NULL, \Joomla\CMS\Form\Form $form = NULL)
{
// If the field is empty and not required, the field is valid.
$required = ((string) $element['required'] == 'true' || (string) $element['required'] == 'required');
if (!$required && empty($value))
{
return true;
}
if (!empty($value))
{
return true;
}
return false;
}
}