acf
This commit is contained in:
57
plugins/fields/acffaq/fields/faq.php
Normal file
57
plugins/fields/acffaq/fields/faq.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Tassos Marinos <info@tassos.gr>
|
||||
* @link http://www.tassos.gr
|
||||
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
|
||||
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Form\Field\SubformField;
|
||||
|
||||
class JFormFieldFAQ extends SubformField
|
||||
{
|
||||
/**
|
||||
* Method to attach a JForm object to the field.
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*
|
||||
* @since 3.6
|
||||
*/
|
||||
public function setup(SimpleXMLElement $element, $value, $group = null)
|
||||
{
|
||||
if (!parent::setup($element, $value, $group))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$xml = <<<XML
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<field
|
||||
name="value"
|
||||
type="subform"
|
||||
hiddenLabel="true"
|
||||
multiple="true"
|
||||
layout="joomla.form.field.subform.repeatable-table"
|
||||
formsource="/plugins/fields/acffaq/fields/value.xml"
|
||||
default='{"faq":{}}'
|
||||
/>
|
||||
</form>
|
||||
XML;
|
||||
$this->formsource = $xml;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getInput()
|
||||
{
|
||||
return '<div class="tf-subform-hide-label">' . parent::getInput() . '</div>';
|
||||
}
|
||||
}
|
||||
34
plugins/fields/acffaq/fields/faqschematoggle.php
Normal file
34
plugins/fields/acffaq/fields/faqschematoggle.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Tassos Marinos <info@tassos.gr>
|
||||
* @link http://www.tassos.gr
|
||||
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
|
||||
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
require_once JPATH_PLUGINS . '/system/nrframework/fields/nrtoggle.php';
|
||||
|
||||
use NRFramework\Extension;
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
class JFormFieldFAQSchemaToggle extends JFormFieldNRToggle
|
||||
{
|
||||
/**
|
||||
* Method to get the field input markup.
|
||||
*
|
||||
* @return string The field input markup.
|
||||
*/
|
||||
public function getInput()
|
||||
{
|
||||
// If GSD Pro is not installed and activated abort
|
||||
if (!Extension::isInstalled('gsd', 'plugin') || !Extension::isPro('plg_system_gsd'))
|
||||
{
|
||||
return '<div class="alert alert-warning">' . Text::_('ACF_FAQ_SCHEMA_GSD_MISSING') . '</div>';
|
||||
}
|
||||
|
||||
return parent::getInput();
|
||||
}
|
||||
}
|
||||
100
plugins/fields/acffaq/fields/helper.php
Normal file
100
plugins/fields/acffaq/fields/helper.php
Normal file
@ -0,0 +1,100 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Tassos Marinos <info@tassos.gr>
|
||||
* @link http://www.tassos.gr
|
||||
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
|
||||
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
$presets = [
|
||||
1 => [
|
||||
'separator' => [
|
||||
'type' => 'nrtoggle',
|
||||
'value' => true
|
||||
],
|
||||
'show_toggle_icon' => [
|
||||
'type' => 'nrtoggle',
|
||||
'value' => true
|
||||
],
|
||||
'icon' => [
|
||||
'type' => 'radio',
|
||||
'value' => 'arrow'
|
||||
],
|
||||
'icon_position' => [
|
||||
'type' => 'radio',
|
||||
'value' => 'right'
|
||||
],
|
||||
],
|
||||
2 => [
|
||||
'separator' => [
|
||||
'type' => 'nrtoggle',
|
||||
'value' => true
|
||||
],
|
||||
'show_toggle_icon' => [
|
||||
'type' => 'nrtoggle',
|
||||
'value' => true
|
||||
],
|
||||
'icon' => [
|
||||
'type' => 'radio',
|
||||
'value' => 'plus_minus'
|
||||
],
|
||||
'icon_position' => [
|
||||
'type' => 'radio',
|
||||
'value' => 'left'
|
||||
],
|
||||
],
|
||||
3 => [
|
||||
'initial_state' => [
|
||||
'type' => 'list',
|
||||
'value' => 'all-open'
|
||||
],
|
||||
'keep_one_question_open' => [
|
||||
'type' => 'nrtoggle',
|
||||
'value' => false
|
||||
],
|
||||
'separator' => [
|
||||
'type' => 'nrtoggle',
|
||||
'value' => true
|
||||
],
|
||||
'show_toggle_icon' => [
|
||||
'type' => 'nrtoggle',
|
||||
'value' => false
|
||||
]
|
||||
],
|
||||
4 => [
|
||||
'separator' => [
|
||||
'type' => 'nrtoggle',
|
||||
'value' => false
|
||||
],
|
||||
'background_color' => [
|
||||
'type' => 'text',
|
||||
'value' => '#fff'
|
||||
],
|
||||
'item_padding' => [
|
||||
'type' => 'number',
|
||||
'responsive' => true,
|
||||
'dimensions' => true,
|
||||
'value' => 20
|
||||
],
|
||||
'item_gap' => [
|
||||
'type' => 'number',
|
||||
'responsive' => true,
|
||||
'value' => 14
|
||||
],
|
||||
'show_toggle_icon' => [
|
||||
'type' => 'nrtoggle',
|
||||
'value' => true
|
||||
],
|
||||
'icon' => [
|
||||
'type' => 'radio',
|
||||
'value' => 'arrow'
|
||||
],
|
||||
'icon_position' => [
|
||||
'type' => 'radio',
|
||||
'value' => 'right'
|
||||
],
|
||||
]
|
||||
];
|
||||
19
plugins/fields/acffaq/fields/value.xml
Normal file
19
plugins/fields/acffaq/fields/value.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form>
|
||||
<fieldset>
|
||||
<field name="question" type="tfeditor"
|
||||
label="ACF_FAQ_QUESTION"
|
||||
hint="ACF_FAQ_QUESTION_HINT"
|
||||
class="span12 full-width w-100"
|
||||
rows="10"
|
||||
filter="raw"
|
||||
/>
|
||||
<field name="answer" type="tfeditor"
|
||||
label="ACF_FAQ_ANSWER"
|
||||
hint="ACF_FAQ_ANSWER_HINT"
|
||||
class="span12 full-width w-100"
|
||||
rows="10"
|
||||
filter="raw"
|
||||
/>
|
||||
</fieldset>
|
||||
</form>
|
||||
Reference in New Issue
Block a user