Merge branch 'staging' into decouple_libraries
This commit is contained in:
commit
b60d208d9e
@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
/**--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||||
__ __ _ _____ _ _ __ __ _ _ _
|
__ __ _ _____ _ _ __ __ _ _ _
|
||||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||||
@ -413,10 +412,11 @@ class Fields extends Structure
|
|||||||
$this->accessBuilder[$viewName] = $viewName;
|
$this->accessBuilder[$viewName] = $viewName;
|
||||||
}
|
}
|
||||||
// set the read only
|
// set the read only
|
||||||
$readOnly = "";
|
$readOnlyXML = array();
|
||||||
if ($view['settings']->type == 2)
|
if ($view['settings']->type == 2)
|
||||||
{
|
{
|
||||||
$readOnly = "\t\t\t" . 'readonly="true"' . PHP_EOL."\t\t\t" . 'disabled="true"';
|
$readOnlyXML['readonly'] = true;
|
||||||
|
$readOnlyXML['disabled'] = true;
|
||||||
}
|
}
|
||||||
// main lang prefix
|
// main lang prefix
|
||||||
$langView = $this->langPrefix . '_' . $this->placeholders['###VIEW###'];
|
$langView = $this->langPrefix . '_' . $this->placeholders['###VIEW###'];
|
||||||
@ -468,209 +468,266 @@ class Fields extends Structure
|
|||||||
$this->setUniqueNameKeeper($field, $view['settings']->type, $name, $viewName);
|
$this->setUniqueNameKeeper($field, $view['settings']->type, $name, $viewName);
|
||||||
}
|
}
|
||||||
// start adding dynamc fields
|
// start adding dynamc fields
|
||||||
$dynamcfields = '';
|
$dynamicFieldsXML = array();
|
||||||
$spacerCounter = 'a';
|
$spacerCounter = 'a';
|
||||||
// set the custom table key
|
// set the custom table key
|
||||||
$dbkey = 'g';
|
$dbkey = 'g';
|
||||||
// TODO we should add the global and local view switch if field for front end
|
// TODO we should add the global and local view switch if field for front end
|
||||||
foreach ($view['settings']->fields as $field)
|
foreach ($view['settings']->fields as $field)
|
||||||
{
|
{
|
||||||
$dynamcfields .= $this->setDynamicField($field, $view, $view['settings']->type, $langView, $viewName, $listViewName, $spacerCounter, $this->placeholders, $dbkey, true);
|
$dynamicFieldsXML[] = $this->setDynamicField($field, $view, $view['settings']->type, $langView, $viewName, $listViewName, $spacerCounter, $this->placeholders, $dbkey, true);
|
||||||
}
|
}
|
||||||
// set the defautl fields
|
// set the default fields
|
||||||
$fieldSet = array();
|
$XML = new simpleXMLElement('<a/>');
|
||||||
$fieldSet[] = '<fieldset name="details">';
|
$fieldSetXML = $XML->addChild('fieldset');
|
||||||
$fieldSet[] = "\t\t<!--" . $this->setLine(__LINE__) . " Default Fields. -->";
|
$fieldSetXML->addAttribute('name', 'details');
|
||||||
$fieldSet[] = "\t\t<!--" . $this->setLine(__LINE__) . " Id Field. Type: Text (joomla) -->";
|
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Default Fields.");
|
||||||
|
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Id Field. Type: Text (joomla)");
|
||||||
// if id is not set
|
// if id is not set
|
||||||
if (!isset($this->fieldsNames[$viewName]['id']))
|
if (!isset($this->fieldsNames[$viewName]['id']))
|
||||||
{
|
{
|
||||||
$fieldSet[] = "\t\t<field";
|
$attributes = array(
|
||||||
$fieldSet[] = "\t\t\tname=" . '"id"';
|
'name' => 'id',
|
||||||
$fieldSet[] = "\t\t\t" . 'type="text" class="readonly" label="JGLOBAL_FIELD_ID_LABEL"';
|
'type' => 'text',
|
||||||
$fieldSet[] = "\t\t\t" . 'description ="JGLOBAL_FIELD_ID_DESC" size="10" default="0"';
|
'class' => 'readonly',
|
||||||
$fieldSet[] = "\t\t\t" . 'readonly="true"';
|
'label' => 'JGLOBAL_FIELD_ID_LABEL',
|
||||||
$fieldSet[] = "\t\t/>";
|
'description' => 'JGLOBAL_FIELD_ID_DESC',
|
||||||
|
'size' => 10,
|
||||||
|
'default' => 0
|
||||||
|
);
|
||||||
|
$fieldXML = $fieldSetXML->addChild('field');
|
||||||
|
$this->xmlAddAttributes($fieldXML, $attributes);
|
||||||
}
|
}
|
||||||
// if created is not set
|
// if created is not set
|
||||||
if (!isset($this->fieldsNames[$viewName]['created']))
|
if (!isset($this->fieldsNames[$viewName]['created']))
|
||||||
{
|
{
|
||||||
$fieldSet[] = "\t\t<!--" . $this->setLine(__LINE__) . " Date Created Field. Type: Calendar (joomla) -->";
|
$attributes = array(
|
||||||
$fieldSet[] = "\t\t<field";
|
'name' => 'created',
|
||||||
$fieldSet[] = "\t\t\tname=" . '"created"';
|
'type' => 'calendar',
|
||||||
$fieldSet[] = "\t\t\ttype=" . '"calendar"';
|
'label' => $langView . '_CREATED_DATE_LABEL',
|
||||||
$fieldSet[] = "\t\t\tlabel=" . '"' . $langView . '_CREATED_DATE_LABEL"';
|
'description' => $langView . '_CREATED_DATE_DESC',
|
||||||
$fieldSet[] = "\t\t\tdescription=" . '"' . $langView . '_CREATED_DATE_DESC"';
|
'size' => 22,
|
||||||
$fieldSet[] = "\t\t\tsize=" . '"22"';
|
'format' => '%Y-%m-%d %H:%M:%S',
|
||||||
$fieldSet[] = $readOnly;
|
'filter' => 'user_utc'
|
||||||
$fieldSet[] = "\t\t\tformat=" . '"%Y-%m-%d %H:%M:%S"';
|
);
|
||||||
$fieldSet[] = "\t\t\tfilter=" . '"user_utc"';
|
$attributes = array_merge($attributes, $readOnlyXML);
|
||||||
$fieldSet[] = "\t\t/>";
|
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Date Created Field. Type: Calendar (joomla)");
|
||||||
|
$fieldXML = $fieldSetXML->addChild('field');
|
||||||
|
$this->xmlAddAttributes($fieldXML, $attributes);
|
||||||
}
|
}
|
||||||
// if created_by is not set
|
// if created_by is not set
|
||||||
if (!isset($this->fieldsNames[$viewName]['created_by']))
|
if (!isset($this->fieldsNames[$viewName]['created_by']))
|
||||||
{
|
{
|
||||||
$fieldSet[] = "\t\t<!--" . $this->setLine(__LINE__) . " User Created Field. Type: User (joomla) -->";
|
$attributes = array(
|
||||||
$fieldSet[] = "\t\t<field";
|
'name' => 'created_by',
|
||||||
$fieldSet[] = "\t\t\tname=" . '"created_by"';
|
'type' => 'user',
|
||||||
$fieldSet[] = "\t\t\ttype=" . '"user"';
|
'label' => $langView . '_CREATED_BY_LABEL',
|
||||||
$fieldSet[] = "\t\t\tlabel=" . '"' . $langView . '_CREATED_BY_LABEL"';
|
'description' => $langView . '_CREATED_BY_DESC',
|
||||||
$fieldSet[] = $readOnly;
|
);
|
||||||
$fieldSet[] = "\t\t\tdescription=" . '"' . $langView . '_CREATED_BY_DESC"';
|
$attributes = array_merge($attributes, $readOnlyXML);
|
||||||
$fieldSet[] = "\t\t/>";
|
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " User Created Field. Type: User (joomla)");
|
||||||
|
$fieldXML = $fieldSetXML->addChild('field');
|
||||||
|
$this->xmlAddAttributes($fieldXML, $attributes);
|
||||||
}
|
}
|
||||||
// if published is not set
|
// if published is not set
|
||||||
if (!isset($this->fieldsNames[$viewName]['published']))
|
if (!isset($this->fieldsNames[$viewName]['published']))
|
||||||
{
|
{
|
||||||
$fieldSet[] = "\t\t<!--" . $this->setLine(__LINE__) . " Published Field. Type: List (joomla) -->";
|
$attributes = array(
|
||||||
$fieldSet[] = "\t\t<field name=" . '"published" type="list" label="JSTATUS"';
|
'name' => 'published',
|
||||||
$fieldSet[] = "\t\t\tdescription=" . '"JFIELD_PUBLISHED_DESC" class="chzn-color-state"';
|
'type' => 'list',
|
||||||
$fieldSet[] = $readOnly;
|
'label' => 'JSTATUS'
|
||||||
$fieldSet[] = "\t\t\tfilter=" . '"intval" size="1" default="1" >';
|
);
|
||||||
$fieldSet[] = "\t\t\t<option value=" . '"1">';
|
$attributes = array_merge($attributes, $readOnlyXML);
|
||||||
$fieldSet[] = "\t\t\t\tJPUBLISHED</option>";
|
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Published Field. Type: List (joomla)");
|
||||||
$fieldSet[] = "\t\t\t<option value=" . '"0">';
|
$fieldXML = $fieldSetXML->addChild('field');
|
||||||
$fieldSet[] = "\t\t\t\tJUNPUBLISHED</option>";
|
$this->xmlAddAttributes($fieldXML, $attributes);
|
||||||
$fieldSet[] = "\t\t\t<option value=" . '"2">';
|
foreach (array('JPUBLISHED' => 1, 'JUNPUBLISHED' => 0, 'JARCHIVED' => 2, 'JTRASHED' => -2) as $text => $value)
|
||||||
$fieldSet[] = "\t\t\t\tJARCHIVED</option>";
|
{
|
||||||
$fieldSet[] = "\t\t\t<option value=" . '"-2">';
|
$optionXML = $fieldXML->addChild('option');
|
||||||
$fieldSet[] = "\t\t\t\tJTRASHED</option>";
|
$optionXML->addAttribute('value', $value);
|
||||||
$fieldSet[] = "\t\t</field>";
|
$optionXML[] = $text;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// if modified is not set
|
// if modified is not set
|
||||||
if (!isset($this->fieldsNames[$viewName]['modified']))
|
if (!isset($this->fieldsNames[$viewName]['modified']))
|
||||||
{
|
{
|
||||||
$fieldSet[] = "\t\t<!--" . $this->setLine(__LINE__) . " Date Modified Field. Type: Calendar (joomla) -->";
|
$attributes = array(
|
||||||
$fieldSet[] = "\t\t" . '<field name="modified" type="calendar" class="readonly"';
|
'name' => 'modified',
|
||||||
$fieldSet[] = "\t\t\t" . 'label="' . $langView . '_MODIFIED_DATE_LABEL" description="' . $langView . '_MODIFIED_DATE_DESC"';
|
'type' => 'calendar',
|
||||||
$fieldSet[] = "\t\t\t" . 'size="22" readonly="true" format="%Y-%m-%d %H:%M:%S" filter="user_utc" />';
|
'class' => 'readonly',
|
||||||
|
'label' => $langView . '_MODIFIED_DATE_LABEL',
|
||||||
|
'description' => $langView . '_MODIFIED_DATE_DESC',
|
||||||
|
'size' => 22,
|
||||||
|
'readonly' => "true",
|
||||||
|
'format' => '%Y-%m-%d %H:%M:%S',
|
||||||
|
'filter' => 'user_utc'
|
||||||
|
);
|
||||||
|
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Date Modified Field. Type: Calendar (joomla)");
|
||||||
|
$fieldXML = $fieldSetXML->addChild('field');
|
||||||
|
$this->xmlAddAttributes($fieldXML, $attributes);
|
||||||
}
|
}
|
||||||
// if modified_by is not set
|
// if modified_by is not set
|
||||||
if (!isset($this->fieldsNames[$viewName]['modified_by']))
|
if (!isset($this->fieldsNames[$viewName]['modified_by']))
|
||||||
{
|
{
|
||||||
$fieldSet[] = "\t\t<!--" . $this->setLine(__LINE__) . " User Modified Field. Type: User (joomla) -->";
|
$attributes = array(
|
||||||
$fieldSet[] = "\t\t" . '<field name="modified_by" type="user"';
|
'name' => 'modified_by',
|
||||||
$fieldSet[] = "\t\t\t" . 'label="' . $langView . '_MODIFIED_BY_LABEL"';
|
'type' => 'user',
|
||||||
$fieldSet[] = "\t\t\tdescription=" . '"' . $langView . '_MODIFIED_BY_DESC"';
|
'label' => $langView . '_MODIFIED_BY_LABEL',
|
||||||
$fieldSet[] = "\t\t\t" . 'class="readonly"';
|
'description' => $langView . '_MODIFIED_BY_DESC',
|
||||||
$fieldSet[] = "\t\t\t" . 'readonly="true"';
|
'class' => 'readonly',
|
||||||
$fieldSet[] = "\t\t\t" . 'filter="unset"';
|
'readonly' => 'true',
|
||||||
$fieldSet[] = "\t\t/>";
|
'filter' => 'unset'
|
||||||
|
);
|
||||||
|
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " User Modified Field. Type: User (joomla)");
|
||||||
|
$fieldXML = $fieldSetXML->addChild('field');
|
||||||
|
$this->xmlAddAttributes($fieldXML, $attributes);
|
||||||
}
|
}
|
||||||
// check if view has access
|
// check if view has access
|
||||||
if (isset($this->accessBuilder[$viewName]) && ComponentbuilderHelper::checkString($this->accessBuilder[$viewName]) && !isset($this->fieldsNames[$viewName]['access']))
|
if (isset($this->accessBuilder[$viewName]) && ComponentbuilderHelper::checkString($this->accessBuilder[$viewName]) && !isset($this->fieldsNames[$viewName]['access']))
|
||||||
{
|
{
|
||||||
$fieldSet[] = "\t\t<!--" . $this->setLine(__LINE__) . " Access Field. Type: Accesslevel (joomla) -->";
|
$attributes = array(
|
||||||
$fieldSet[] = "\t\t" . '<field name="access"';
|
'name' => 'access',
|
||||||
$fieldSet[] = "\t\t\t" . 'type="accesslevel"';
|
'type' => 'accesslevel',
|
||||||
$fieldSet[] = "\t\t\t" . 'label="JFIELD_ACCESS_LABEL"';
|
'label' => 'JFIELD_ACCESS_LABEL',
|
||||||
$fieldSet[] = "\t\t\t" . 'description="JFIELD_ACCESS_DESC"';
|
'description' => 'JFIELD_ACCESS_DESC',
|
||||||
$fieldSet[] = "\t\t\t" . 'default="1"';
|
'default' => 1,
|
||||||
$fieldSet[] = $readOnly;
|
'required' => "false"
|
||||||
$fieldSet[] = "\t\t\t" . 'required="false"';
|
);
|
||||||
$fieldSet[] = "\t\t/>";
|
$attributes = array_merge($attributes, $readOnlyXML);
|
||||||
|
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Access Field. Type: Accesslevel (joomla)");
|
||||||
|
$fieldXML = $fieldSetXML->addChild('field');
|
||||||
|
$this->xmlAddAttributes($fieldXML, $attributes);
|
||||||
}
|
}
|
||||||
// if ordering is not set
|
// if ordering is not set
|
||||||
if (!isset($this->fieldsNames[$viewName]['ordering']))
|
if (!isset($this->fieldsNames[$viewName]['ordering']))
|
||||||
{
|
{
|
||||||
$fieldSet[] = "\t\t<!--" . $this->setLine(__LINE__) . " Ordering Field. Type: Numbers (joomla) -->";
|
$attributes = array(
|
||||||
$fieldSet[] = "\t\t<field";
|
'name' => 'ordering',
|
||||||
$fieldSet[] = "\t\t\t" . 'name="ordering"';
|
'type' => 'number',
|
||||||
$fieldSet[] = "\t\t\t" . 'type="number"';
|
'class' => 'inputbox validate-ordering',
|
||||||
$fieldSet[] = "\t\t\t" . 'class="inputbox validate-ordering"';
|
'label' => $langView . '_ORDERING_LABEL',
|
||||||
$fieldSet[] = "\t\t\t" . 'label="' . $langView . '_ORDERING_LABEL' . '"';
|
'description' => '',
|
||||||
$fieldSet[] = "\t\t\t" . 'description=""';
|
'default' => 0,
|
||||||
$fieldSet[] = "\t\t\t" . 'default="0"';
|
'size' => 6,
|
||||||
$fieldSet[] = "\t\t\t" . 'size="6"';
|
'required' => "false"
|
||||||
$fieldSet[] = $readOnly;
|
);
|
||||||
$fieldSet[] = "\t\t\t" . 'required="false"';
|
$attributes = array_merge($attributes, $readOnlyXML);
|
||||||
$fieldSet[] = "\t\t/>";
|
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Ordering Field. Type: Numbers (joomla)");
|
||||||
|
$fieldXML = $fieldSetXML->addChild('field');
|
||||||
|
$this->xmlAddAttributes($fieldXML, $attributes);
|
||||||
}
|
}
|
||||||
// if version is not set
|
// if version is not set
|
||||||
if (!isset($this->fieldsNames[$viewName]['version']))
|
if (!isset($this->fieldsNames[$viewName]['version']))
|
||||||
{
|
{
|
||||||
$fieldSet[] = "\t\t<!--" . $this->setLine(__LINE__) . " Version Field. Type: Text (joomla) -->";
|
$attributes = array(
|
||||||
$fieldSet[] = "\t\t<field";
|
'name' => 'version',
|
||||||
$fieldSet[] = "\t\t\t" . 'name="version"';
|
'type' => 'text',
|
||||||
$fieldSet[] = "\t\t\t" . 'type="text"';
|
'class' => 'readonly',
|
||||||
$fieldSet[] = "\t\t\t" . 'class="readonly"';
|
'label' => $langView . '_VERSION_LABEL',
|
||||||
$fieldSet[] = "\t\t\t" . 'label="' . $langView . '_VERSION_LABEL"';
|
'description' => $langView . '_VERSION_DESC',
|
||||||
$fieldSet[] = "\t\t\t" . 'description="' . $langView . '_VERSION_DESC"';
|
'size' => 6,
|
||||||
$fieldSet[] = "\t\t\t" . 'size="6"';
|
'readonly' => "true",
|
||||||
$fieldSet[] = "\t\t\t" . 'readonly="true"';
|
'filter' => 'unset'
|
||||||
$fieldSet[] = "\t\t\t" . 'filter="unset"';
|
);
|
||||||
$fieldSet[] = "\t\t/>";
|
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Version Field. Type: Text (joomla)");
|
||||||
|
$fieldXML = $fieldSetXML->addChild('field');
|
||||||
|
$this->xmlAddAttributes($fieldXML, $attributes);
|
||||||
}
|
}
|
||||||
// check if metadata is added to this view
|
// check if metadata is added to this view
|
||||||
if (isset($this->metadataBuilder[$viewName]) && ComponentbuilderHelper::checkString($this->metadataBuilder[$viewName]))
|
if (isset($this->metadataBuilder[$viewName]) && ComponentbuilderHelper::checkString($this->metadataBuilder[$viewName]))
|
||||||
{
|
{
|
||||||
// metakey
|
// metakey
|
||||||
$fieldSet[] = "\t\t<!--" . $this->setLine(__LINE__) . " Metakey Field. Type: Textarea (joomla) -->";
|
$attributes = array(
|
||||||
$fieldSet[] = "\t\t<field";
|
'name' => 'metakey',
|
||||||
$fieldSet[] = "\t\t\t" . 'name="metakey"';
|
'type' => 'textarea',
|
||||||
$fieldSet[] = "\t\t\t" . 'type="textarea"';
|
'label' => 'JFIELD_META_KEYWORDS_LABEL',
|
||||||
$fieldSet[] = "\t\t\t" . 'label="JFIELD_META_KEYWORDS_LABEL"';
|
'description' => 'JFIELD_META_KEYWORDS_DESC',
|
||||||
$fieldSet[] = "\t\t\t" . 'description="JFIELD_META_KEYWORDS_DESC"';
|
'rows' => 3,
|
||||||
$fieldSet[] = "\t\t\t" . 'rows="3"';
|
'cols' => 30
|
||||||
$fieldSet[] = "\t\t\t" . 'cols="30"';
|
);
|
||||||
$fieldSet[] = "\t\t/>";
|
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Metakey Field. Type: Textarea (joomla)");
|
||||||
|
$fieldXML = $fieldSetXML->addChild('field');
|
||||||
|
$this->xmlAddAttributes($fieldXML, $attributes);
|
||||||
// metadesc
|
// metadesc
|
||||||
$fieldSet[] = "\t\t<!--" . $this->setLine(__LINE__) . " Metadesc Field. Type: Textarea (joomla) -->";
|
$attributes['name'] = 'metadesc';
|
||||||
$fieldSet[] = "\t\t<field";
|
$attributes['label'] = 'JFIELD_META_DESCRIPTION_LABEL';
|
||||||
$fieldSet[] = "\t\t\t" . 'name="metadesc"';
|
$attributes['description'] = 'JFIELD_META_DESCRIPTION_DESC';
|
||||||
$fieldSet[] = "\t\t\t" . 'type="textarea"';
|
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Metadesc Field. Type: Textarea (joomla)");
|
||||||
$fieldSet[] = "\t\t\t" . 'label="JFIELD_META_DESCRIPTION_LABEL"';
|
$fieldXML = $fieldSetXML->addChild('field');
|
||||||
$fieldSet[] = "\t\t\t" . 'description="JFIELD_META_DESCRIPTION_DESC"';
|
$this->xmlAddAttributes($fieldXML, $attributes);
|
||||||
$fieldSet[] = "\t\t\t" . 'rows="3"';
|
|
||||||
$fieldSet[] = "\t\t\t" . 'cols="30"';
|
|
||||||
$fieldSet[] = "\t\t/>";
|
|
||||||
}
|
}
|
||||||
// load the dynamic fields now
|
// load the dynamic fields now
|
||||||
if (ComponentbuilderHelper::checkString($dynamcfields))
|
if (count($dynamicFieldsXML))
|
||||||
{
|
{
|
||||||
$fieldSet[] = "\t\t<!--" . $this->setLine(__LINE__) . " Dynamic Fields. -->" . $dynamcfields;
|
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Dynamic Fields.");
|
||||||
|
foreach ($dynamicFieldsXML as $dynamicfield)
|
||||||
|
{
|
||||||
|
$this->xmlAppend($fieldSetXML, $dynamicfield);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// close fieldset
|
|
||||||
$fieldSet[] = "\t</fieldset>";
|
|
||||||
// check if metadata is added to this view
|
// check if metadata is added to this view
|
||||||
if (isset($this->metadataBuilder[$viewName]) && ComponentbuilderHelper::checkString($this->metadataBuilder[$viewName]))
|
if (isset($this->metadataBuilder[$viewName]) && ComponentbuilderHelper::checkString($this->metadataBuilder[$viewName]))
|
||||||
{
|
{
|
||||||
$fieldSet[] = PHP_EOL."\t<!--" . $this->setLine(__LINE__) . " Metadata Fields. -->";
|
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Metadata Fields");
|
||||||
$fieldSet[] = "\t<fields" . ' name="metadata" label="JGLOBAL_FIELDSET_METADATA_OPTIONS">';
|
$fieldsXML = $fieldSetXML->addChild('fields');
|
||||||
$fieldSet[] = "\t\t" . '<fieldset name="vdmmetadata"';
|
$fieldsXML->addAttribute('name', 'metadata');
|
||||||
$fieldSet[] = "\t\t\t" . 'label="JGLOBAL_FIELDSET_METADATA_OPTIONS">';
|
$fieldsXML->addAttribute('label', 'JGLOBAL_FIELDSET_METADATA_OPTIONS');
|
||||||
|
$fieldsFieldSetXML = $fieldsXML->addChild('fieldset');
|
||||||
|
$fieldsFieldSetXML->addAttribute('name', 'vdmmetadata');
|
||||||
|
$fieldsFieldSetXML->addAttribute('label', 'JGLOBAL_FIELDSET_METADATA_OPTIONS');
|
||||||
// robots
|
// robots
|
||||||
$fieldSet[] = "\t\t\t<!--" . $this->setLine(__LINE__) . " Robots Field. Type: List (joomla) -->";
|
$this->xmlComment($fieldsFieldSetXML, $this->setLine(__LINE__) . " Robots Field. Type: List (joomla)");
|
||||||
$fieldSet[] = "\t\t\t" . '<field name="robots"';
|
$robots = $fieldsFieldSetXML->addChild('field');
|
||||||
$fieldSet[] = "\t\t\t\t" . 'type="list"';
|
$attributes = array(
|
||||||
$fieldSet[] = "\t\t\t\t" . 'label="JFIELD_METADATA_ROBOTS_LABEL"';
|
'name' => 'robots',
|
||||||
$fieldSet[] = "\t\t\t\t" . 'description="JFIELD_METADATA_ROBOTS_DESC" >';
|
'type' => 'list',
|
||||||
$fieldSet[] = "\t\t\t\t" . '<option value="">JGLOBAL_USE_GLOBAL</option>';
|
'label' => 'JFIELD_METADATA_ROBOTS_LABEL',
|
||||||
$fieldSet[] = "\t\t\t\t" . '<option value="index, follow">JGLOBAL_INDEX_FOLLOW</option>';
|
'description' => 'JFIELD_METADATA_ROBOTS_DESC'
|
||||||
$fieldSet[] = "\t\t\t\t" . '<option value="noindex, follow">JGLOBAL_NOINDEX_FOLLOW</option>';
|
);
|
||||||
$fieldSet[] = "\t\t\t\t" . '<option value="index, nofollow">JGLOBAL_INDEX_NOFOLLOW</option>';
|
$this->xmlAddAttributes($robots, $attributes);
|
||||||
$fieldSet[] = "\t\t\t\t" . '<option value="noindex, nofollow">JGLOBAL_NOINDEX_NOFOLLOW</option>';
|
$options = array(
|
||||||
$fieldSet[] = "\t\t\t" . '</field>';
|
'JGLOBAL_USE_GLOBAL' => '',
|
||||||
|
'JGLOBAL_INDEX_FOLLOW' => 'index, follow',
|
||||||
|
'JGLOBAL_NOINDEX_FOLLOW' => 'noindex, follow',
|
||||||
|
'JGLOBAL_INDEX_NOFOLLOW' => 'index, nofollow',
|
||||||
|
'JGLOBAL_NOINDEX_NOFOLLOW' => 'noindex, nofollow',
|
||||||
|
);
|
||||||
|
foreach ($options as $text => $value)
|
||||||
|
{
|
||||||
|
$option = $robots->addChild('option');
|
||||||
|
$option->addAttribute('value', $value);
|
||||||
|
$option[] = $text;
|
||||||
|
}
|
||||||
// author
|
// author
|
||||||
$fieldSet[] = "\t\t\t<!--" . $this->setLine(__LINE__) . " Author Field. Type: Text (joomla) -->";
|
$this->xmlComment($fieldsFieldSetXML, $this->setLine(__LINE__) . " Author Field. Type: Text (joomla)");
|
||||||
$fieldSet[] = "\t\t\t" . '<field name="author"';
|
$author = $fieldsFieldSetXML->addChild('field');
|
||||||
$fieldSet[] = "\t\t\t\t" . 'type="text"';
|
$attributes = array(
|
||||||
$fieldSet[] = "\t\t\t\t" . 'label="JAUTHOR" description="JFIELD_METADATA_AUTHOR_DESC"';
|
'name' => 'author',
|
||||||
$fieldSet[] = "\t\t\t\t" . 'size="20"';
|
'type' => 'text',
|
||||||
$fieldSet[] = "\t\t\t/>";
|
'label' => 'JAUTHOR',
|
||||||
|
'description' => 'JFIELD_METADATA_AUTHOR_DESC',
|
||||||
|
'size' => 20
|
||||||
|
);
|
||||||
|
$this->xmlAddAttributes($author, $attributes);
|
||||||
// rights
|
// rights
|
||||||
$fieldSet[] = "\t\t\t<!--" . $this->setLine(__LINE__) . " Rights Field. Type: Textarea (joomla) -->";
|
$this->xmlComment($fieldsFieldSetXML, $this->setLine(__LINE__) . " Rights Field. Type: Textarea (joomla)");
|
||||||
$fieldSet[] = "\t\t\t" . '<field name="rights" type="textarea" label="JFIELD_META_RIGHTS_LABEL"';
|
$rights = $fieldsFieldSetXML->addChild('field');
|
||||||
$fieldSet[] = "\t\t\t\t" . 'description="JFIELD_META_RIGHTS_DESC" required="false" filter="string"';
|
$attributes = array(
|
||||||
$fieldSet[] = "\t\t\t\t" . 'cols="30" rows="2"';
|
'name' => 'rights',
|
||||||
$fieldSet[] = "\t\t\t/>";
|
'type' => 'textarea',
|
||||||
$fieldSet[] = "\t\t</fieldset>";
|
'label' => 'JFIELD_META_RIGHTS_LABEL',
|
||||||
$fieldSet[] = "\t</fields>";
|
'description' => 'JFIELD_META_RIGHTS_DESC',
|
||||||
|
'required' => 'false',
|
||||||
|
'filter' => 'string',
|
||||||
|
'cols' => 30,
|
||||||
|
'rows' => 2
|
||||||
|
);
|
||||||
|
$this->xmlAddAttributes($rights, $attributes);
|
||||||
}
|
}
|
||||||
// just to be safe, lets clear the view placeholders
|
// just to be safe, lets clear the view placeholders
|
||||||
$this->clearFromPlaceHolders('view');
|
$this->clearFromPlaceHolders('view');
|
||||||
// retunr the set
|
// return the set
|
||||||
return implode(PHP_EOL, $fieldSet);
|
return $this->xmlPrettyPrint($XML, 'fieldset');
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@ -702,7 +759,7 @@ class Fields extends Structure
|
|||||||
* @param string $dbkey The the custom table key
|
* @param string $dbkey The the custom table key
|
||||||
* @param boolean $build The switch to set the build option
|
* @param boolean $build The switch to set the build option
|
||||||
*
|
*
|
||||||
* @return string The complete field in xml
|
* @return SimpleXMLElement The complete field in xml
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function setDynamicField(&$field, &$view, &$viewType, &$langView, &$viewName, &$listViewName, &$spacerCounter, &$placeholders, &$dbkey, $build)
|
public function setDynamicField(&$field, &$view, &$viewType, &$langView, &$viewName, &$listViewName, &$spacerCounter, &$placeholders, &$dbkey, $build)
|
||||||
@ -714,7 +771,6 @@ class Fields extends Structure
|
|||||||
$typeName = ComponentbuilderHelper::safeString($field['settings']->type_name);
|
$typeName = ComponentbuilderHelper::safeString($field['settings']->type_name);
|
||||||
$multiple = false;
|
$multiple = false;
|
||||||
$langLabel = '';
|
$langLabel = '';
|
||||||
$taber = '';
|
|
||||||
$fieldSet = '';
|
$fieldSet = '';
|
||||||
$fieldAttributes = array();
|
$fieldAttributes = array();
|
||||||
// set field attributes
|
// set field attributes
|
||||||
@ -730,7 +786,7 @@ class Fields extends Structure
|
|||||||
//reset options array
|
//reset options array
|
||||||
$optionArray = array();
|
$optionArray = array();
|
||||||
// now add to the field set
|
// now add to the field set
|
||||||
$fieldSet .= $this->setField('option', $taber, $fieldAttributes, $name, $typeName, $langView, $viewName, $listViewName, $placeholders, $optionArray);
|
$xmlElement = $this->setField('option', $fieldAttributes, $name, $typeName, $langView, $viewName, $listViewName, $placeholders, $optionArray);
|
||||||
if ($build)
|
if ($build)
|
||||||
{
|
{
|
||||||
// set builders
|
// set builders
|
||||||
@ -745,7 +801,7 @@ class Fields extends Structure
|
|||||||
$this->setBuilders($langLabel, $langView, $viewName, $listViewName, $name, $view, $field, $typeName, $multiple);
|
$this->setBuilders($langLabel, $langView, $viewName, $listViewName, $name, $view, $field, $typeName, $multiple);
|
||||||
}
|
}
|
||||||
// now add to the field set
|
// now add to the field set
|
||||||
$fieldSet .= $this->setField('plain', $taber, $fieldAttributes, $name, $typeName, $langView, $viewName, $listViewName, $placeholders, $optionArray);
|
$xmlElement = $this->setField('plain', $fieldAttributes, $name, $typeName, $langView, $viewName, $listViewName, $placeholders, $optionArray);
|
||||||
}
|
}
|
||||||
elseif ($this->defaultField($typeName, 'spacer'))
|
elseif ($this->defaultField($typeName, 'spacer'))
|
||||||
{
|
{
|
||||||
@ -765,7 +821,7 @@ class Fields extends Structure
|
|||||||
$this->setLayoutBuilder($viewName, $tabName, $name, $field);
|
$this->setLayoutBuilder($viewName, $tabName, $name, $field);
|
||||||
}
|
}
|
||||||
// now add to the field set
|
// now add to the field set
|
||||||
$fieldSet .= $this->setField('spacer', $taber, $fieldAttributes, $name, $typeName, $langView, $viewName, $listViewName, $placeholders, $optionArray);
|
$xmlElement = $this->setField('spacer', $fieldAttributes, $name, $typeName, $langView, $viewName, $listViewName, $placeholders, $optionArray);
|
||||||
// increment spacer counter
|
// increment spacer counter
|
||||||
if ($typeName === 'spacer')
|
if ($typeName === 'spacer')
|
||||||
{
|
{
|
||||||
@ -783,7 +839,7 @@ class Fields extends Structure
|
|||||||
$this->setBuilders($langLabel, $langView, $viewName, $listViewName, $name, $view, $field, $typeName, $multiple, false);
|
$this->setBuilders($langLabel, $langView, $viewName, $listViewName, $name, $view, $field, $typeName, $multiple, false);
|
||||||
}
|
}
|
||||||
// now add to the field set
|
// now add to the field set
|
||||||
$fieldSet .= $this->setField('special', $taber, $fieldAttributes, $name, $typeName, $langView, $viewName, $listViewName, $placeholders, $optionArray);
|
$xmlElement = $this->setField('special', $fieldAttributes, $name, $typeName, $langView, $viewName, $listViewName, $placeholders, $optionArray);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif (ComponentbuilderHelper::checkArray($fieldAttributes['custom']))
|
elseif (ComponentbuilderHelper::checkArray($fieldAttributes['custom']))
|
||||||
@ -801,56 +857,56 @@ class Fields extends Structure
|
|||||||
$this->setBuilders($langLabel, $langView, $viewName, $listViewName, $name, $view, $field, $typeName, $multiple, $custom);
|
$this->setBuilders($langLabel, $langView, $viewName, $listViewName, $name, $view, $field, $typeName, $multiple, $custom);
|
||||||
}
|
}
|
||||||
// now add to the field set
|
// now add to the field set
|
||||||
$fieldSet .= $this->setField('custom', $taber, $fieldAttributes, $name, $typeName, $langView, $viewName, $listViewName, $placeholders, $optionArray, $custom);
|
$xmlElement = $this->setField('custom', $fieldAttributes, $name, $typeName, $langView, $viewName, $listViewName, $placeholders, $optionArray, $custom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $fieldSet;
|
return $xmlElement;
|
||||||
}
|
}
|
||||||
return '';
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set a field
|
* set a field
|
||||||
*
|
*
|
||||||
* @param string $setType The set of fields type
|
* @param string $setType The set of fields type
|
||||||
* @param string $taber The tabs to add in layout
|
|
||||||
* @param array $fieldAttributes The field values
|
* @param array $fieldAttributes The field values
|
||||||
* @param string $name The field name
|
* @param string $name The field name
|
||||||
* @param string $typeName The field type
|
* @param string $typeName The field type
|
||||||
* @param string $langView The language string of the view
|
* @param string $langView The language string of the view
|
||||||
* @param string $viewName The singel view name
|
* @param string $viewName The single view name
|
||||||
* @param string $listViewName The list view name
|
* @param string $listViewName The list view name
|
||||||
* @param array $placeholders The place holder and replace values
|
* @param array $placeholders The place holder and replace values
|
||||||
* @param string $optionArray The option bucket array used to set the field options if needed.
|
* @param string $optionArray The option bucket array used to set the field options if needed.
|
||||||
* @param arra $custom Used when field is from config
|
* @param array $custom Used when field is from config
|
||||||
*
|
*
|
||||||
* @return string The field in xml
|
* @return SimpleXMLElement The field in xml
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private function setField($setType, $taber, &$fieldAttributes, &$name, &$typeName, &$langView, &$viewName, &$listViewName, $placeholders, &$optionArray, $custom = null)
|
private function setField($setType, &$fieldAttributes, &$name, &$typeName, &$langView, &$viewName, &$listViewName, $placeholders, &$optionArray, $custom = null)
|
||||||
{
|
{
|
||||||
$fieldSet = '';
|
$field = new stdClass();
|
||||||
if ($setType === 'option')
|
if ($setType === 'option')
|
||||||
{
|
{
|
||||||
// now add to the field set
|
// now add to the field set
|
||||||
$fieldSet .= PHP_EOL."\t" . $taber . "\t<!--" . $this->setLine(__LINE__) . " " . ComponentbuilderHelper::safeString($name, 'F') . " Field. Type: " . ComponentbuilderHelper::safeString($typeName, 'F') . ". (joomla) -->";
|
$field->fieldXML = new SimpleXMLElement('<field/>');
|
||||||
$fieldSet .= PHP_EOL."\t" . $taber . "\t<field";
|
$field->comment = $this->setLine(__LINE__) . " " . ComponentbuilderHelper::safeString($name, 'F') . " Field. Type: " . ComponentbuilderHelper::safeString($typeName, 'F') . ". (joomla)";
|
||||||
$optionSet = '';
|
|
||||||
foreach ($fieldAttributes as $property => $value)
|
foreach ($fieldAttributes as $property => $value)
|
||||||
{
|
{
|
||||||
if ($property != 'option')
|
if ($property != 'option')
|
||||||
{
|
{
|
||||||
$fieldSet .= PHP_EOL."\t\t" . $taber . "\t" . $property . '="' . $value . '"';
|
$field->fieldXML->addAttribute($property, $value);
|
||||||
}
|
}
|
||||||
elseif ($property === 'option')
|
elseif ($property === 'option')
|
||||||
{
|
{
|
||||||
$optionSet = '';
|
$this->xmlComment($field->fieldXML, $this->setLine(__LINE__) . " Option Set.");
|
||||||
if (strpos($value, ',') !== false)
|
if (strpos($value, ',') !== false)
|
||||||
{
|
{
|
||||||
// mulitpal options
|
// mulitpal options
|
||||||
$options = explode(',', $value);
|
$options = explode(',', $value);
|
||||||
foreach ($options as $option)
|
foreach ($options as $option)
|
||||||
{
|
{
|
||||||
|
$optionXML = $field->fieldXML->addChild('option');
|
||||||
if (strpos($option, '|') !== false)
|
if (strpos($option, '|') !== false)
|
||||||
{
|
{
|
||||||
// has other value then text
|
// has other value then text
|
||||||
@ -859,7 +915,7 @@ class Fields extends Structure
|
|||||||
// add to lang array
|
// add to lang array
|
||||||
$this->langContent[$this->lang][$langValue] = $t;
|
$this->langContent[$this->lang][$langValue] = $t;
|
||||||
// no add to option set
|
// no add to option set
|
||||||
$optionSet .= PHP_EOL."\t" . $taber . "\t\t" . '<option value="' . $v . '">' . PHP_EOL."\t" . $taber . "\t\t\t" . $langValue . '</option>';
|
$optionXML->addAttribute('value', $v);
|
||||||
$optionArray[$v] = $langValue;
|
$optionArray[$v] = $langValue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -869,14 +925,16 @@ class Fields extends Structure
|
|||||||
// add to lang array
|
// add to lang array
|
||||||
$this->langContent[$this->lang][$langValue] = $option;
|
$this->langContent[$this->lang][$langValue] = $option;
|
||||||
// no add to option set
|
// no add to option set
|
||||||
$optionSet .= PHP_EOL."\t\t" . $taber . "\t" . '<option value="' . $option . '">' . PHP_EOL."\t\t" . $taber . "\t\t" . $langValue . '</option>';
|
$optionXML->addAttribute('value', $option);
|
||||||
$optionArray[$option] = $langValue;
|
$optionArray[$option] = $langValue;
|
||||||
}
|
}
|
||||||
|
$optionXML[] = $langValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// one option
|
// one option
|
||||||
|
$optionXML = $field->fieldXML->addChild('option');
|
||||||
if (strpos($value, '|') !== false)
|
if (strpos($value, '|') !== false)
|
||||||
{
|
{
|
||||||
// has other value then text
|
// has other value then text
|
||||||
@ -885,7 +943,7 @@ class Fields extends Structure
|
|||||||
// add to lang array
|
// add to lang array
|
||||||
$this->langContent[$this->lang][$langValue] = $t;
|
$this->langContent[$this->lang][$langValue] = $t;
|
||||||
// no add to option set
|
// no add to option set
|
||||||
$optionSet .= PHP_EOL."\t\t" . $taber . "\t" . '<option value="' . $v . '">' . PHP_EOL."\t\t" . $taber . "\t\t" . $langValue . '</option>';
|
$optionXML->addAttribute('value', $v);
|
||||||
$optionArray[$v] = $langValue;
|
$optionArray[$v] = $langValue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -895,58 +953,45 @@ class Fields extends Structure
|
|||||||
// add to lang array
|
// add to lang array
|
||||||
$this->langContent[$this->lang][$langValue] = $value;
|
$this->langContent[$this->lang][$langValue] = $value;
|
||||||
// no add to option set
|
// no add to option set
|
||||||
$optionSet .= PHP_EOL."\t\t" . $taber . "\t" . '<option value="' . $value . '">' . PHP_EOL."\t\t" . $taber . "\t\t" . $langValue . '</option>';
|
$optionXML->addAttribute('value', $value);
|
||||||
$optionArray[$value] = $langValue;
|
$optionArray[$value] = $langValue;
|
||||||
}
|
}
|
||||||
|
$optionXML[] = $langValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ComponentbuilderHelper::checkString($optionSet))
|
if (!$field->fieldXML->count())
|
||||||
{
|
{
|
||||||
$fieldSet .= '>';
|
$this->xmlComment($field->fieldXML, $this->setLine(__LINE__) . " No Manual Options Were Added In Field Settings.");
|
||||||
$fieldSet .= PHP_EOL."\t\t\t" . $taber . "<!--" . $this->setLine(__LINE__) . " Option Set. -->";
|
|
||||||
$fieldSet .= $optionSet;
|
|
||||||
$fieldSet .= PHP_EOL."\t\t" . $taber . "</field>";
|
|
||||||
}
|
|
||||||
elseif ($typeName === 'sql')
|
|
||||||
{
|
|
||||||
$optionArray = false;
|
|
||||||
$fieldSet .= PHP_EOL."\t\t" . $taber . "/>";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$optionArray = false;
|
|
||||||
$fieldSet .= PHP_EOL."\t\t\t" . $taber . "<!--" . $this->setLine(__LINE__) . " No Manual Options Were Added In Field Settings. -->";
|
|
||||||
$fieldSet .= PHP_EOL."\t\t" . $taber . "/>";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($setType === 'plain')
|
elseif ($setType === 'plain')
|
||||||
{
|
{
|
||||||
// now add to the field set
|
// now add to the field set
|
||||||
$fieldSet .= PHP_EOL."\t\t" . $taber . "<!--" . $this->setLine(__LINE__) . " " . ComponentbuilderHelper::safeString($name, 'F') . " Field. Type: " . ComponentbuilderHelper::safeString($typeName, 'F') . ". (joomla) -->";
|
$field->fieldXML = new SimpleXMLElement('<field/>');
|
||||||
$fieldSet .= PHP_EOL."\t\t" . $taber . "<field";
|
$field->comment = $this->setLine(__LINE__) . " " . ComponentbuilderHelper::safeString($name, 'F') . " Field. Type: " . ComponentbuilderHelper::safeString($typeName, 'F') . ". (joomla)";
|
||||||
|
|
||||||
foreach ($fieldAttributes as $property => $value)
|
foreach ($fieldAttributes as $property => $value)
|
||||||
{
|
{
|
||||||
if ($property != 'option')
|
if ($property != 'option')
|
||||||
{
|
{
|
||||||
$fieldSet .= PHP_EOL."\t\t" . $taber . "\t" . $property . '="' . $value . '"';
|
$field->fieldXML->addAttribute($property, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$fieldSet .= PHP_EOL."\t\t" . $taber . "/>";
|
|
||||||
}
|
}
|
||||||
elseif ($setType === 'spacer')
|
elseif ($setType === 'spacer')
|
||||||
{
|
{
|
||||||
// now add to the field set
|
// now add to the field set
|
||||||
$fieldSet .= PHP_EOL."\t\t<!--" . $this->setLine(__LINE__) . " " . ComponentbuilderHelper::safeString($name, 'F') . " Field. Type: " . ComponentbuilderHelper::safeString($typeName, 'F') . ". A None Database Field. (joomla) -->";
|
$field->fieldXML = new SimpleXMLElement('<field/>');
|
||||||
$fieldSet .= PHP_EOL."\t\t<field";
|
$field->comment = $this->setLine(__LINE__) . " " . ComponentbuilderHelper::safeString($name, 'F') . " Field. Type: " . ComponentbuilderHelper::safeString($typeName, 'F') . ". A None Database Field. (joomla)";
|
||||||
|
|
||||||
foreach ($fieldAttributes as $property => $value)
|
foreach ($fieldAttributes as $property => $value)
|
||||||
{
|
{
|
||||||
if ($property != 'option')
|
if ($property != 'option')
|
||||||
{
|
{
|
||||||
$fieldSet .= " " . $property . '="' . $value . '"';
|
$field->fieldXML->addAttribute($property, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$fieldSet .= " />";
|
|
||||||
}
|
}
|
||||||
elseif ($setType === 'special')
|
elseif ($setType === 'special')
|
||||||
{
|
{
|
||||||
@ -954,19 +999,24 @@ class Fields extends Structure
|
|||||||
if ($typeName === 'repeatable')
|
if ($typeName === 'repeatable')
|
||||||
{
|
{
|
||||||
// now add to the field set
|
// now add to the field set
|
||||||
$fieldSet .= PHP_EOL."\t\t<!--" . $this->setLine(__LINE__) . " " . ComponentbuilderHelper::safeString($name, 'F') . " Field. Type: " . ComponentbuilderHelper::safeString($typeName, 'F') . ". (joomla) -->";
|
$field->fieldXML = new SimpleXMLElement('<field/>');
|
||||||
$fieldSet .= PHP_EOL."\t\t<field";
|
$field->comment = $this->setLine(__LINE__) . " " . ComponentbuilderHelper::safeString($name, 'F') . " Field. Type: " . ComponentbuilderHelper::safeString($typeName, 'F') . ". (depreciated)";
|
||||||
$fieldsSet = array();
|
|
||||||
foreach ($fieldAttributes as $property => $value)
|
foreach ($fieldAttributes as $property => $value)
|
||||||
{
|
{
|
||||||
if ($property != 'fields')
|
if ($property != 'fields')
|
||||||
{
|
{
|
||||||
$fieldSet .= PHP_EOL."\t\t\t" . $property . '="' . $value . '"';
|
$field->fieldXML->addAttribute($property, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$fieldSet .= ">";
|
$fieldsXML = $field->fieldXML->addChild('fields');
|
||||||
$fieldSet .= PHP_EOL."\t\t\t" . '<fields name="' . $fieldAttributes['name'] . '_fields" label="">';
|
$fieldsXML->addAttribute('name', $fieldAttributes['name'] . '_fields');
|
||||||
$fieldSet .= PHP_EOL."\t\t\t\t" . '<fieldset hidden="true" name="' . $fieldAttributes['name'] . '_modal" repeat="true">';
|
$fieldsXML->addAttribute('label', '');
|
||||||
|
$fieldSetXML = $fieldsXML->addChild('fieldset');
|
||||||
|
$fieldSetXML->addAttribute('hidden', 'true');
|
||||||
|
$fieldSetXML->addAttribute('name', $fieldAttributes['name'] . '_modal');
|
||||||
|
$fieldSetXML->addAttribute('repeat', 'true');
|
||||||
|
|
||||||
if (strpos($fieldAttributes['fields'], ',') !== false)
|
if (strpos($fieldAttributes['fields'], ',') !== false)
|
||||||
{
|
{
|
||||||
// mulitpal fields
|
// mulitpal fields
|
||||||
@ -991,8 +1041,6 @@ class Fields extends Structure
|
|||||||
$r_typeName = ComponentbuilderHelper::safeString($fieldData['settings']->type_name);
|
$r_typeName = ComponentbuilderHelper::safeString($fieldData['settings']->type_name);
|
||||||
$r_multiple = false;
|
$r_multiple = false;
|
||||||
$r_langLabel = '';
|
$r_langLabel = '';
|
||||||
// add the tabs needed
|
|
||||||
$taber = "\t\t\t";
|
|
||||||
// get field values
|
// get field values
|
||||||
$r_fieldValues = $this->setFieldAttributes($fieldData, $view, $r_name, $r_typeName, $r_multiple, $r_langLabel, $langView, $spacerCounter, $listViewName, $viewName, $placeholders, true);
|
$r_fieldValues = $this->setFieldAttributes($fieldData, $view, $r_name, $r_typeName, $r_multiple, $r_langLabel, $langView, $spacerCounter, $listViewName, $viewName, $placeholders, true);
|
||||||
// check if values were set
|
// check if values were set
|
||||||
@ -1003,12 +1051,12 @@ class Fields extends Structure
|
|||||||
if ($this->defaultField($r_typeName, 'option'))
|
if ($this->defaultField($r_typeName, 'option'))
|
||||||
{
|
{
|
||||||
// now add to the field set
|
// now add to the field set
|
||||||
$fieldSet .= $this->setField('option', $taber, $r_fieldValues, $r_name, $r_typeName, $langView, $viewName, $listViewName, $placeholders, $r_optionArray);
|
$this->xmlAppend($fieldSetXML, $this->setField('option', $r_fieldValues, $r_name, $r_typeName, $langView, $viewName, $listViewName, $placeholders, $r_optionArray));
|
||||||
}
|
}
|
||||||
elseif ($this->defaultField($r_typeName, 'plain'))
|
elseif ($this->defaultField($r_typeName, 'plain'))
|
||||||
{
|
{
|
||||||
// now add to the field set
|
// now add to the field set
|
||||||
$fieldSet .= $this->setField('plain', $taber, $r_fieldValues, $r_name, $r_typeName, $langView, $viewName, $listViewName, $placeholders, $r_optionArray);
|
$this->xmlAppend($fieldSetXML, $this->setField('plain', $r_fieldValues, $r_name, $r_typeName, $langView, $viewName, $listViewName, $placeholders, $r_optionArray));
|
||||||
}
|
}
|
||||||
elseif (ComponentbuilderHelper::checkArray($r_fieldValues['custom']))
|
elseif (ComponentbuilderHelper::checkArray($r_fieldValues['custom']))
|
||||||
{
|
{
|
||||||
@ -1016,7 +1064,7 @@ class Fields extends Structure
|
|||||||
$custom = $r_fieldValues['custom'];
|
$custom = $r_fieldValues['custom'];
|
||||||
unset($r_fieldValues['custom']);
|
unset($r_fieldValues['custom']);
|
||||||
// now add to the field set
|
// now add to the field set
|
||||||
$fieldSet .= $this->setField('custom', $taber, $r_fieldValues, $r_name, $r_typeName, $langView, $viewName, $listViewName, $placeholders, $r_optionArray);
|
$this->xmlAppend($fieldSetXML, $this->setField('custom', $r_fieldValues, $r_name, $r_typeName, $langView, $viewName, $listViewName, $placeholders, $r_optionArray));
|
||||||
// set lang (just incase)
|
// set lang (just incase)
|
||||||
$r_listLangName = $langView . '_' . ComponentbuilderHelper::safeString($r_name, 'U');
|
$r_listLangName = $langView . '_' . ComponentbuilderHelper::safeString($r_name, 'U');
|
||||||
// add to lang array
|
// add to lang array
|
||||||
@ -1035,37 +1083,40 @@ class Fields extends Structure
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$fieldSet .= PHP_EOL."\t\t\t\t</fieldset>";
|
|
||||||
$fieldSet .= PHP_EOL."\t\t\t</fields>";
|
|
||||||
$fieldSet .= PHP_EOL."\t\t</field>";
|
|
||||||
}
|
}
|
||||||
// set the subform fields (it is a repeatable without the modal)
|
// set the subform fields (it is a repeatable without the modal)
|
||||||
elseif ($typeName === 'subform')
|
elseif ($typeName === 'subform')
|
||||||
{
|
{
|
||||||
// now add to the field set
|
// now add to the field set
|
||||||
$fieldSet .= PHP_EOL."\t\t<!--" . $this->setLine(__LINE__) . " " . ComponentbuilderHelper::safeString($name, 'F') . " Field. Type: " . ComponentbuilderHelper::safeString($typeName, 'F') . ". (joomla) -->";
|
$field->fieldXML = new SimpleXMLElement('<field/>');
|
||||||
$fieldSet .= PHP_EOL."\t\t<field";
|
$field->comment = $this->setLine(__LINE__) . " " . ComponentbuilderHelper::safeString($name, 'F') . " Field. Type: " . ComponentbuilderHelper::safeString($typeName, 'F') . ". (joomla)";
|
||||||
$fieldsSet = array();
|
// add all properties
|
||||||
foreach ($fieldAttributes as $property => $value)
|
foreach ($fieldAttributes as $property => $value)
|
||||||
{
|
{
|
||||||
if ($property != 'fields' && $property != 'formsource')
|
if ($property != 'fields' && $property != 'formsource')
|
||||||
{
|
{
|
||||||
$fieldSet .= PHP_EOL."\t\t\t" . $property . '="' . $value . '"';
|
$field->fieldXML->addAttribute($property, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if we detect formsource we do not add the form
|
// if we detect formsource we do not add the form
|
||||||
if (isset($fieldAttributes['formsource']) && ComponentbuilderHelper::checkString($fieldAttributes['formsource']))
|
if (isset($fieldAttributes['formsource']) && ComponentbuilderHelper::checkString($fieldAttributes['formsource']))
|
||||||
{
|
{
|
||||||
$fieldSet .= PHP_EOL."\t\t\tformsource". '="' . $fieldAttributes['formsource'] . '"';
|
$field->fieldXML->addAttribute('formsource', $fieldAttributes['formsource']);
|
||||||
$fieldSet .= PHP_EOL."\t\t />";
|
|
||||||
}
|
}
|
||||||
|
// add the form
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$fieldSet .= ">";
|
$form = $field->fieldXML->addChild('form');
|
||||||
$fieldSet .= PHP_EOL."\t\t\t" . '<form hidden="true" name="list_' . $fieldAttributes['name'] . '_modal" repeat="true">';
|
$attributes = array(
|
||||||
|
'hidden' => 'true',
|
||||||
|
'name' => 'list_' . $fieldAttributes['name'] . '_modal',
|
||||||
|
'repeat' => 'true'
|
||||||
|
);
|
||||||
|
$this->xmlAddAttributes($form, $attributes);
|
||||||
|
|
||||||
if (strpos($fieldAttributes['fields'], ',') !== false)
|
if (strpos($fieldAttributes['fields'], ',') !== false)
|
||||||
{
|
{
|
||||||
// mulitpal fields
|
// multiple fields
|
||||||
$fieldsSets = (array) explode(',', $fieldAttributes['fields']);
|
$fieldsSets = (array) explode(',', $fieldAttributes['fields']);
|
||||||
}
|
}
|
||||||
elseif (is_numeric($fieldAttributes['fields']))
|
elseif (is_numeric($fieldAttributes['fields']))
|
||||||
@ -1087,8 +1138,6 @@ class Fields extends Structure
|
|||||||
$r_typeName = ComponentbuilderHelper::safeString($fieldData['settings']->type_name);
|
$r_typeName = ComponentbuilderHelper::safeString($fieldData['settings']->type_name);
|
||||||
$r_multiple = false;
|
$r_multiple = false;
|
||||||
$r_langLabel = '';
|
$r_langLabel = '';
|
||||||
// add the tabs needed
|
|
||||||
$taber = "\t\t";
|
|
||||||
// get field values
|
// get field values
|
||||||
$r_fieldValues = $this->setFieldAttributes($fieldData, $view, $r_name, $r_typeName, $r_multiple, $r_langLabel, $langView, $spacerCounter, $listViewName, $viewName, $placeholders, true);
|
$r_fieldValues = $this->setFieldAttributes($fieldData, $view, $r_name, $r_typeName, $r_multiple, $r_langLabel, $langView, $spacerCounter, $listViewName, $viewName, $placeholders, true);
|
||||||
// check if values were set
|
// check if values were set
|
||||||
@ -1099,12 +1148,12 @@ class Fields extends Structure
|
|||||||
if ($this->defaultField($r_typeName, 'option'))
|
if ($this->defaultField($r_typeName, 'option'))
|
||||||
{
|
{
|
||||||
// now add to the field set
|
// now add to the field set
|
||||||
$fieldSet .= $this->setField('option', $taber, $r_fieldValues, $r_name, $r_typeName, $langView, $viewName, $listViewName, $placeholders, $r_optionArray);
|
$this->xmlAppend($form, $this->setField('option', $r_fieldValues, $r_name, $r_typeName, $langView, $viewName, $listViewName, $placeholders, $r_optionArray));
|
||||||
}
|
}
|
||||||
elseif ($this->defaultField($r_typeName, 'plain'))
|
elseif ($this->defaultField($r_typeName, 'plain'))
|
||||||
{
|
{
|
||||||
// now add to the field set
|
// now add to the field set
|
||||||
$fieldSet .= $this->setField('plain', $taber, $r_fieldValues, $r_name, $r_typeName, $langView, $viewName, $listViewName, $placeholders, $r_optionArray);
|
$this->xmlAppend($form, $this->setField('plain', $r_fieldValues, $r_name, $r_typeName, $langView, $viewName, $listViewName, $placeholders, $r_optionArray));
|
||||||
}
|
}
|
||||||
elseif (ComponentbuilderHelper::checkArray($r_fieldValues['custom']))
|
elseif (ComponentbuilderHelper::checkArray($r_fieldValues['custom']))
|
||||||
{
|
{
|
||||||
@ -1112,7 +1161,7 @@ class Fields extends Structure
|
|||||||
$custom = $r_fieldValues['custom'];
|
$custom = $r_fieldValues['custom'];
|
||||||
unset($r_fieldValues['custom']);
|
unset($r_fieldValues['custom']);
|
||||||
// now add to the field set
|
// now add to the field set
|
||||||
$fieldSet .= $this->setField('custom', $taber, $r_fieldValues, $r_name, $r_typeName, $langView, $viewName, $listViewName, $placeholders, $r_optionArray);
|
$this->xmlAppend($form, $this->setField('custom', $r_fieldValues, $r_name, $r_typeName, $langView, $viewName, $listViewName, $placeholders, $r_optionArray));
|
||||||
// set lang (just incase)
|
// set lang (just incase)
|
||||||
$r_listLangName = $langView . '_' . ComponentbuilderHelper::safeString($r_name, 'U');
|
$r_listLangName = $langView . '_' . ComponentbuilderHelper::safeString($r_name, 'U');
|
||||||
// add to lang array
|
// add to lang array
|
||||||
@ -1131,24 +1180,21 @@ class Fields extends Structure
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$fieldSet .= PHP_EOL."\t\t\t</form>";
|
|
||||||
$fieldSet .= PHP_EOL."\t\t</field>";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($setType === 'custom')
|
elseif ($setType === 'custom')
|
||||||
{
|
{
|
||||||
// now add to the field set
|
// now add to the field set
|
||||||
$fieldSet .= PHP_EOL."\t\t" . $taber . "<!--" . $this->setLine(__LINE__) . " " . ComponentbuilderHelper::safeString($name, 'F') . " Field. Type: " . ComponentbuilderHelper::safeString($typeName, 'F') . ". (custom) -->";
|
$field->fieldXML = new SimpleXMLElement('<field/>');
|
||||||
$fieldSet .= PHP_EOL."\t\t" . $taber . "<field";
|
$field->comment = $this->setLine(__LINE__) . " " . ComponentbuilderHelper::safeString($name, 'F') . " Field. Type: " . ComponentbuilderHelper::safeString($typeName, 'F') . ". (custom)";
|
||||||
foreach ($fieldAttributes as $property => $value)
|
foreach ($fieldAttributes as $property => $value)
|
||||||
{
|
{
|
||||||
if ($property != 'option')
|
if ($property != 'option')
|
||||||
{
|
{
|
||||||
$fieldSet .= PHP_EOL."\t\t" . $taber . "\t" . $property . '="' . $value . '"';
|
$field->fieldXML->addAttribute($property, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$fieldSet .= PHP_EOL."\t\t" . $taber . "/>";
|
|
||||||
// incase the field is in the config and has not been set
|
// incase the field is in the config and has not been set
|
||||||
if ('config' === $viewName && 'configs' === $listViewName)
|
if ('config' === $viewName && 'configs' === $listViewName)
|
||||||
{
|
{
|
||||||
@ -1160,7 +1206,7 @@ class Fields extends Structure
|
|||||||
$this->setCustomFieldTypeFile($data, $listViewName, $viewName);
|
$this->setCustomFieldTypeFile($data, $listViewName, $viewName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $fieldSet;
|
return $field;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1305,7 +1351,7 @@ class Fields extends Structure
|
|||||||
*/
|
*/
|
||||||
private function setFieldAttributes(&$field, &$viewType, &$name, &$typeName, &$multiple, &$langLabel, $langView, &$spacerCounter, $listViewName, $viewName, $placeholders, $repeatable = false)
|
private function setFieldAttributes(&$field, &$viewType, &$name, &$typeName, &$multiple, &$langLabel, $langView, &$spacerCounter, $listViewName, $viewName, $placeholders, $repeatable = false)
|
||||||
{
|
{
|
||||||
// reset array`
|
// reset array
|
||||||
$fieldAttributes = array();
|
$fieldAttributes = array();
|
||||||
$setCustom = false;
|
$setCustom = false;
|
||||||
// setup joomla default fields
|
// setup joomla default fields
|
||||||
@ -1537,7 +1583,7 @@ class Fields extends Structure
|
|||||||
// check if translatable
|
// check if translatable
|
||||||
if (ComponentbuilderHelper::checkString($xmlValue) && isset($property['translatable']) && $property['translatable'] == 1)
|
if (ComponentbuilderHelper::checkString($xmlValue) && isset($property['translatable']) && $property['translatable'] == 1)
|
||||||
{
|
{
|
||||||
// update lable if field use multiple times
|
// update label if field use multiple times
|
||||||
if ($property['name'] === 'label')
|
if ($property['name'] === 'label')
|
||||||
{
|
{
|
||||||
if (isset($fieldAttributes['name']) && isset($this->uniqueNames[$viewName]['names'][$fieldAttributes['name']]))
|
if (isset($fieldAttributes['name']) && isset($this->uniqueNames[$viewName]['names'][$fieldAttributes['name']]))
|
||||||
@ -2244,4 +2290,121 @@ class Fields extends Structure
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlComment
|
||||||
|
*
|
||||||
|
* @param SimpleXMLElement $xml The XML element reference in which to inject a comment
|
||||||
|
* @param string $comment The comment to inject
|
||||||
|
*
|
||||||
|
* @return null
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function xmlComment(&$xml, $comment)
|
||||||
|
{
|
||||||
|
$domXML = dom_import_simplexml($xml);
|
||||||
|
$domComment = new DOMComment($comment);
|
||||||
|
$nodeTarget = $domXML->ownerDocument->importNode($domComment, true);
|
||||||
|
$domXML->appendChild($nodeTarget);
|
||||||
|
$xml = simplexml_import_dom($domXML);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlAddAttributes
|
||||||
|
*
|
||||||
|
* @param SimpleXMLElement $xml The XML element reference in which to inject a comment
|
||||||
|
* @param array $attributes The attributes to apply to the XML element
|
||||||
|
*
|
||||||
|
* @return null
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function xmlAddAttributes(&$xml, $attributes = array())
|
||||||
|
{
|
||||||
|
foreach ($attributes as $key => $value)
|
||||||
|
{
|
||||||
|
$xml->addAttribute($key, $value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlAppend
|
||||||
|
*
|
||||||
|
* @param SimpleXMLElement $xml The XML element reference in which to inject a comment
|
||||||
|
* @param mixed $node A SimpleXMLElement node to append to the XML element reference, or a stdClass object containing a comment attribute to be injected before the XML node and a fieldXML attribute containing a SimpleXMLElement
|
||||||
|
*
|
||||||
|
* @return null
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function xmlAppend(&$xml, $node)
|
||||||
|
{
|
||||||
|
if (!$node)
|
||||||
|
{ // element was not returned
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (get_class($node))
|
||||||
|
{
|
||||||
|
case 'stdClass':
|
||||||
|
if (property_exists($node, 'comment'))
|
||||||
|
{
|
||||||
|
$this->xmlComment($xml, $node->comment);
|
||||||
|
}
|
||||||
|
if (property_exists($node, 'fieldXML'))
|
||||||
|
{
|
||||||
|
$this->xmlAppend($xml, $node->fieldXML);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'SimpleXMLElement':
|
||||||
|
$domXML = dom_import_simplexml($xml);
|
||||||
|
$domNode = dom_import_simplexml($node);
|
||||||
|
$domXML->appendChild($domXML->ownerDocument->importNode($domNode, true));
|
||||||
|
$xml = simplexml_import_dom($domXML);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlPrettyPrint
|
||||||
|
*
|
||||||
|
* @param SimpleXMLElement $xml The XML element containing a node to be output
|
||||||
|
* @param string $nodename node name of the input xml element to print out. this is done to omit the <?xml... tag
|
||||||
|
*
|
||||||
|
* @return string XML output
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function xmlPrettyPrint($xml, $nodename)
|
||||||
|
{
|
||||||
|
$dom = dom_import_simplexml($xml)->ownerDocument;
|
||||||
|
$dom->formatOutput = true;
|
||||||
|
$xmlString = $dom->saveXML($dom->getElementsByTagName($nodename)->item(0));
|
||||||
|
$tidy = new Tidy();
|
||||||
|
$tidy->parseString($xmlString,array('indent'=>true,'indent-spaces'=>8,'input-xml'=>true,'output-xml'=>true,'indent-attributes'=>true,'wrap-attributes'=>true,'wrap'=>false));
|
||||||
|
$tidy->cleanRepair();
|
||||||
|
return $this->xmlIndent((string)$tidy,' ',8,true,false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlIndent
|
||||||
|
*
|
||||||
|
* @param string $string The XML input
|
||||||
|
* @param string $char Character or characters to use as the repeated indent
|
||||||
|
* @param integer $depth number of times to repeat the indent character
|
||||||
|
* @param boolean $skipfirst Skip the first line of the input.
|
||||||
|
* @param boolean $skiplast Skip the last line of the input;
|
||||||
|
*
|
||||||
|
* @return string XML output
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function xmlIndent($string,$char=' ',$depth=0,$skipfirst=false,$skiplast=false)
|
||||||
|
{
|
||||||
|
$output = array();
|
||||||
|
$lines = explode("\n",$string);
|
||||||
|
$first = true;
|
||||||
|
$last = count($lines)-1;
|
||||||
|
foreach($lines as $i=>$line)
|
||||||
|
{
|
||||||
|
$output[] = (($first&&$skipfirst)||$i===$last&&$skiplast)?$line:str_repeat($char,$depth).$line;
|
||||||
|
$first = false;
|
||||||
|
}
|
||||||
|
return implode("\n",$output);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1653,13 +1653,19 @@ class Interpretation extends Fields
|
|||||||
public function setCustomViewFieldUikitChecker(&$get, $checker, $string, $code, $tab = '')
|
public function setCustomViewFieldUikitChecker(&$get, $checker, $string, $code, $tab = '')
|
||||||
{
|
{
|
||||||
$fieldUikit = '';
|
$fieldUikit = '';
|
||||||
|
$runplugins = false;
|
||||||
foreach ($checker as $field => $array)
|
foreach ($checker as $field => $array)
|
||||||
{
|
{
|
||||||
if (strpos($get['selection']['select'], $field) !== false)
|
if (strpos($get['selection']['select'], $field) !== false)
|
||||||
{
|
{
|
||||||
// build decoder string
|
// build decoder string
|
||||||
$fieldUikit .= PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)." Make sure the content prepare plugins fire on ".$field." (TODO)";
|
if(!$runplugins) {
|
||||||
$fieldUikit .= PHP_EOL."\t".$tab."\t".$string."->".$field." = JHtml::_('content.prepare',".$string."->".$field.");";
|
$runplugins = PHP_EOL.$tab."\t//".$this->setLine(__LINE__)." Load the JEvent Dispatcher";
|
||||||
|
$runplugins .= PHP_EOL.$tab."\tJPluginHelper::importPlugin('content');";
|
||||||
|
$runplugins .= PHP_EOL.$tab."\t".'$this->_dispatcher = JEventDispatcher::getInstance();';
|
||||||
|
}
|
||||||
|
$fieldUikit .= PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)." Make sure the content prepare plugins fire on ".$field;
|
||||||
|
$fieldUikit .= PHP_EOL."\t".$tab."\t".'$this->_dispatcher->trigger("onContentPrepare",array($this->_context,&'.$string.'->'.$field.',$item->params));';
|
||||||
// only load for uikit version 2 (TODO) we may need to add another check here
|
// only load for uikit version 2 (TODO) we may need to add another check here
|
||||||
if (2 == $this->uikit || 1 == $this->uikit)
|
if (2 == $this->uikit || 1 == $this->uikit)
|
||||||
{
|
{
|
||||||
@ -1668,6 +1674,9 @@ class Interpretation extends Fields
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// load dispatcher
|
||||||
|
$this->JEventDispatcher = array('###DISPATCHER###' => ($runplugins?:''));
|
||||||
|
// return UIKIT fix
|
||||||
return $fieldUikit;
|
return $fieldUikit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2123,6 +2132,8 @@ class Interpretation extends Fields
|
|||||||
$getItem .= PHP_EOL."\t".$tab."\t\treturn false;";
|
$getItem .= PHP_EOL."\t".$tab."\t\treturn false;";
|
||||||
}
|
}
|
||||||
$getItem .= PHP_EOL."\t".$tab."\t}";
|
$getItem .= PHP_EOL."\t".$tab."\t}";
|
||||||
|
// dispatcher placholder
|
||||||
|
$getItem .= "###DISPATCHER###";
|
||||||
if (ComponentbuilderHelper::checkArray($get->main_get))
|
if (ComponentbuilderHelper::checkArray($get->main_get))
|
||||||
{
|
{
|
||||||
$asBucket = array();
|
$asBucket = array();
|
||||||
@ -2203,7 +2214,8 @@ class Interpretation extends Fields
|
|||||||
$getItem .= PHP_EOL.PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)." set data object to item.";
|
$getItem .= PHP_EOL.PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)." set data object to item.";
|
||||||
$getItem .= PHP_EOL."\t".$tab."\t\$this->_item[\$pk] = \$data;";
|
$getItem .= PHP_EOL."\t".$tab."\t\$this->_item[\$pk] = \$data;";
|
||||||
}
|
}
|
||||||
return $getItem;
|
// check if the dispather should be added
|
||||||
|
return str_replace(array_keys($this->JEventDispatcher), array_values($this->JEventDispatcher), $getItem);
|
||||||
}
|
}
|
||||||
return PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)."add your custom code here.";
|
return PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)."add your custom code here.";
|
||||||
}
|
}
|
||||||
@ -2526,6 +2538,8 @@ class Interpretation extends Fields
|
|||||||
$methods .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." check if there was data returned";
|
$methods .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." check if there was data returned";
|
||||||
$methods .= PHP_EOL."\t\tif (\$db->getNumRows())";
|
$methods .= PHP_EOL."\t\tif (\$db->getNumRows())";
|
||||||
$methods .= PHP_EOL."\t\t{";
|
$methods .= PHP_EOL."\t\t{";
|
||||||
|
// set dispatcher placeholder
|
||||||
|
$methods .= "###DISPATCHER###";
|
||||||
// set decoding of needed fields
|
// set decoding of needed fields
|
||||||
if (isset($this->siteFieldData['decode'][$default['code']][$get['key']][$default['as']]))
|
if (isset($this->siteFieldData['decode'][$default['code']][$get['key']][$default['as']]))
|
||||||
{
|
{
|
||||||
@ -2632,10 +2646,12 @@ class Interpretation extends Fields
|
|||||||
$methods = str_replace('###CRYPT###', $script, $methods);
|
$methods = str_replace('###CRYPT###', $script, $methods);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// insure the crypt placeholder is removed
|
||||||
$methods = str_replace('###CRYPT###','',$methods);
|
$methods = str_replace('###CRYPT###','',$methods);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $methods.PHP_EOL;
|
// check if the dispatcher must be set
|
||||||
|
return str_replace(array_keys($this->JEventDispatcher), array_values($this->JEventDispatcher), $methods).PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setCustomViewMethodDefaults($get,$code)
|
public function setCustomViewMethodDefaults($get,$code)
|
||||||
@ -2734,6 +2750,7 @@ class Interpretation extends Fields
|
|||||||
$getItem .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Convert the parameter fields into objects.";
|
$getItem .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Convert the parameter fields into objects.";
|
||||||
$getItem .= PHP_EOL."\t\tif (".$Component."Helper::checkArray(\$items))";
|
$getItem .= PHP_EOL."\t\tif (".$Component."Helper::checkArray(\$items))";
|
||||||
$getItem .= PHP_EOL."\t\t{";
|
$getItem .= PHP_EOL."\t\t{";
|
||||||
|
$getItem .= "###DISPATCHER###";
|
||||||
$getItem .= PHP_EOL."\t\t\tforeach (\$items as \$nr => &\$item)";
|
$getItem .= PHP_EOL."\t\t\tforeach (\$items as \$nr => &\$item)";
|
||||||
$getItem .= PHP_EOL."\t\t\t{";
|
$getItem .= PHP_EOL."\t\t\t{";
|
||||||
$getItem .= PHP_EOL."\t\t\t\t//".$this->setLine(__LINE__)." Always create a slug for sef URL's";
|
$getItem .= PHP_EOL."\t\t\t\t//".$this->setLine(__LINE__)." Always create a slug for sef URL's";
|
||||||
@ -2773,6 +2790,8 @@ class Interpretation extends Fields
|
|||||||
$asBucket[] = $main_get['as'];
|
$asBucket[] = $main_get['as'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// check if we should load the dispatcher
|
||||||
|
$getItem = str_replace(array_keys($this->JEventDispatcher), array_values($this->JEventDispatcher), $getItem);
|
||||||
// setup Globals
|
// setup Globals
|
||||||
$getItem .= $this->setCustomViewGlobals($get->global,'$item',$asBucket,"\t\t");
|
$getItem .= $this->setCustomViewGlobals($get->global,'$item',$asBucket,"\t\t");
|
||||||
// setup the custom gets that returns multipal values
|
// setup the custom gets that returns multipal values
|
||||||
|
Loading…
Reference in New Issue
Block a user