* @github Joomla Component Builder * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ // No direct access to this file defined('_JEXEC') or die('Restricted access'); function buildSubform() { // get the subform $subform = JFormHelper::loadFieldType('subform', true); // make sure the layout is created // JLayoutHelper::render('assistantsubformrepeatable', null); // start building the subform field XML $subformXML = new SimpleXMLElement(''); // subform attributes $subformAttribute = array( 'type' => 'subform', 'name' => 'views', 'label' => 'COM_COMPONENTBUILDER_VIEW_BUILDER', 'layout' => 'assistantsubformrepeatable', 'multiple' => 'true', 'icon' => 'list', 'max' => 20, 'min' => 1 ); // load the subform attributes ComponentbuilderHelper::xmlAddAttributes($subformXML, $subformAttribute); // now add the subform child form $childForm = $subformXML->addChild('form'); // child form attributes $childFormAttribute = array( 'hidden' => 'true', 'name' => 'list_properties', 'repeat' => 'true'); // load the child form attributes ComponentbuilderHelper::xmlAddAttributes($childForm, $childFormAttribute); // view building the name field XML $nameXML = new SimpleXMLElement(''); // subform attributes $nameAttribute = array( 'type' => 'text', 'name' => 'name', 'label' => 'COM_COMPONENTBUILDER_VIEW_NAME', 'size' => '40', 'maxlength' => '150', 'class' => 'text_area', 'hint' => 'COM_COMPONENTBUILDER_VIEW_NAME', 'filter' => 'STRING' ); // load the subform attributes ComponentbuilderHelper::xmlAddAttributes($nameXML, $nameAttribute); // now add the fields to the child form ComponentbuilderHelper::xmlAppend($childForm, $nameXML); // view building the list name field XML $listnameXML = new SimpleXMLElement(''); // subform attributes $listnameAttribute = array( 'type' => 'text', 'name' => 'list_name', 'label' => 'COM_COMPONENTBUILDER_LIST_VIEW_NAME', 'size' => '40', 'maxlength' => '150', 'class' => 'text_area', 'hint' => 'COM_COMPONENTBUILDER_LIST_VIEW_NAME', 'filter' => 'STRING' ); // load the subform attributes ComponentbuilderHelper::xmlAddAttributes($listnameXML, $listnameAttribute); // now add the fields to the child form ComponentbuilderHelper::xmlAppend($childForm, $listnameXML); // start building the builder area XML $noteXML = new SimpleXMLElement(''); // subform attributes $noteAttribute = array( 'type' => 'note', 'name' => 'builder', 'label' => 'COM_COMPONENTBUILDER_BUILDER', 'description' => '

', 'heading' => 'h5' ); // load the subform attributes ComponentbuilderHelper::xmlAddAttributes($noteXML, $noteAttribute); // now add the fields to the child form ComponentbuilderHelper::xmlAppend($childForm, $noteXML); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// FIELDS SUBFORM START ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // start building the subform field XML $sub_subformXML = new SimpleXMLElement(''); // subform attributes $sub_subformAttribute = array( 'type' => 'subform', 'name' => 'fields', 'label' => 'COM_COMPONENTBUILDER_FIELD_BUILDER', 'layout' => 'joomla.form.field.subform.repeatable-table', 'multiple' => 'true', 'icon' => 'list', 'max' => 20, 'min' => 1 ); // load the subform attributes ComponentbuilderHelper::xmlAddAttributes($sub_subformXML, $sub_subformAttribute); // now add the subform child form $sub_childform = $sub_subformXML->addChild('form'); // child form attributes $sub_childformAttribute = array( 'hidden' => 'true', 'name' => 'list_properties', 'repeat' => 'true'); // load the child form attributes ComponentbuilderHelper::xmlAddAttributes($sub_childform, $sub_childformAttribute); // view building the name field XML $nameXML = new SimpleXMLElement(''); // subform attributes $nameAttribute = array( 'type' => 'text', 'name' => 'name', 'label' => 'COM_COMPONENTBUILDER_FIELD_NAME', 'size' => '40', 'maxlength' => '150', 'class' => 'text_area', 'hint' => 'COM_COMPONENTBUILDER_FIELD_NAME', 'filter' => 'STRING' ); // load the subform attributes ComponentbuilderHelper::xmlAddAttributes($nameXML, $nameAttribute); // now add the fields to the child form ComponentbuilderHelper::xmlAppend($sub_childform, $nameXML); // view building the field type XML $fieldtypeXML = new SimpleXMLElement(''); // subform attributes $fieldtypeAttribute = array( 'type' => 'fieldtypes', 'name' => 'fieldtype', 'label' => 'COM_COMPONENTBUILDER_FIELD_TYPE', 'multiple' => false, 'required' => true, 'class' => 'btn-group', 'addfieldpath' => '/administrator/components/com_componentbuilder/models/fields' ); // load the subform attributes ComponentbuilderHelper::xmlAddAttributes($fieldtypeXML, $fieldtypeAttribute); // now add the fields to the child form ComponentbuilderHelper::xmlAppend($sub_childform, $fieldtypeXML); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// FIELDPROPERTIES SUBFORM START ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // start building the subform field XML $sub_sub_subformXML = new SimpleXMLElement(''); // subform attributes $sub_sub_subformAttribute = array( 'type' => 'subform', 'name' => 'properties', 'label' => 'COM_COMPONENTBUILDER_PROPERTIES', 'layout' => 'joomla.form.field.subform.repeatable', 'multiple' => 'true', 'icon' => 'list' ); // load the subform attributes ComponentbuilderHelper::xmlAddAttributes($sub_sub_subformXML, $sub_sub_subformAttribute); // now add the subform child form $sub_sub_childform = $sub_sub_subformXML->addChild('form'); // child form attributes $sub_sub_childformAttribute = array( 'hidden' => 'true', 'name' => 'list_properties', 'repeat' => 'true'); // load the child form attributes ComponentbuilderHelper::xmlAddAttributes($sub_sub_childform, $sub_sub_childformAttribute); // view building the list name field XML $propertiesXML = new SimpleXMLElement(''); // subform attributes $propertiesAttribute = array( 'type' => 'text', 'name' => 'property', 'label' => 'COM_COMPONENTBUILDER_PROPERTY', 'size' => '100', 'maxlength' => '150', 'class' => 'text_area', 'hint' => 'COM_COMPONENTBUILDER_PROPERTY_NAME', 'filter' => 'STRING' ); // load the subform attributes ComponentbuilderHelper::xmlAddAttributes($propertiesXML, $propertiesAttribute); // now add the fields to the child form ComponentbuilderHelper::xmlAppend($sub_sub_childform, $propertiesXML); // view building the value field XML $valueXML = new SimpleXMLElement(''); // subform attributes $valueAttribute = array( 'type' => 'text', 'name' => 'value', 'label' => 'COM_COMPONENTBUILDER_VALUE', 'size' => '40', 'maxlength' => '150', 'class' => 'text_area', 'hint' => 'COM_COMPONENTBUILDER_PROPERTY_VALUE', 'filter' => 'STRING' ); // load the subform attributes ComponentbuilderHelper::xmlAddAttributes($valueXML, $valueAttribute); // now add the fields to the child form ComponentbuilderHelper::xmlAppend($sub_sub_childform, $valueXML); // no add to main sub from ComponentbuilderHelper::xmlAppend($sub_childform, $sub_sub_subformXML); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// FIELDPROPERTIES SUBFORM END ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // no add to main sub from ComponentbuilderHelper::xmlAppend($childForm, $sub_subformXML); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// FIELDS SUBFORM END ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// LISTVIEW START ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // start building the listview area XML $listviewXML = new SimpleXMLElement(''); // subform attributes $listviewAttribute = array( 'type' => 'note', 'name' => 'columns', 'label' => 'COM_COMPONENTBUILDER_ROW_SELECTION', 'description' => ' More details soon, to help you select the fields for the list display of rows.', 'heading' => 'h5' ); // load the subform attributes ComponentbuilderHelper::xmlAddAttributes($listviewXML, $listviewAttribute); // now add the fields to the child form ComponentbuilderHelper::xmlAppend($childForm, $listviewXML); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// LISTVIEW END ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// DISPLAY START ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // start building the display area XML $displayXML = new SimpleXMLElement(''); // subform attributes $displayAttribute = array( 'type' => 'note', 'name' => 'display', 'label' => 'COM_COMPONENTBUILDER_ITEM_DISPLAY', 'description' => ' More details soon, to help build the site/front display of a single item.', 'heading' => 'h5' ); // load the subform attributes ComponentbuilderHelper::xmlAddAttributes($displayXML, $displayAttribute); // now add the fields to the child form ComponentbuilderHelper::xmlAppend($childForm, $displayXML); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// DISPLAY END ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // setup subform with values $subform->setup($subformXML, null, 'jcbform'); // return subfrom object return $subform; } // get the subform $subform = buildSubform(); ?>
label; ?>
input; ?>