Resolved gh-321 by adding the option te set a create menu for admin edit views that are also added to the front-end.

This commit is contained in:
2019-04-09 23:54:54 +02:00
parent fd154a81bc
commit a817bae010
9 changed files with 61 additions and 14 deletions

View File

@ -1162,7 +1162,7 @@ class Get
return $value;
}, $array);
// check if we must add to site
if (isset($array['edit_create_site_view']) && $array['edit_create_site_view'])
if (isset($array['edit_create_site_view']) && is_numeric($array['edit_create_site_view']) && $array['edit_create_site_view'] > 0)
{
$this->siteEditView[$array['adminview']] = true;
$this->lang = 'both';

View File

@ -963,7 +963,7 @@ class Structure extends Get
$config = array($this->hhh . 'CREATIONDATE' . $this->hhh => $created, $this->hhh . 'BUILDDATE' . $this->hhh => $modified, $this->hhh . 'VERSION' . $this->hhh => $view['settings']->version);
$this->buildDynamique($target, 'single', false, $config);
}
if (isset($view['edit_create_site_view']) && $view['edit_create_site_view'])
if (isset($view['edit_create_site_view']) && is_numeric($view['edit_create_site_view']) && $view['edit_create_site_view'] > 0)
{
// setup the front site edit-view files
$target = array('site' => $view['settings']->name_single);

View File

@ -1470,6 +1470,32 @@ class Interpretation extends Fields
return '';
}
public function setAdminViewMenu(&$viewName_single, &$view)
{
$xml = '';
// build the file
$target = array('site' => $viewName_single);
$done = $this->buildDynamique($target, 'admin_menu');
if ($done)
{
// set the lang
$lang = ComponentbuilderHelper::safeString('com_' . $this->fileContentStatic[$this->hhh . 'component' . $this->hhh] . '_menu_' . $viewName_single, 'U');
$this->langContent['adminsys'][$lang . '_TITLE'] = 'Create ' . $view['settings']->name_single;
$this->langContent['adminsys'][$lang . '_OPTION'] = 'Create ' . $view['settings']->name_single;
$this->langContent['adminsys'][$lang . '_DESC'] = $view['settings']->short_description;
//start loading xml
$xml = '<?xml version="1.0" encoding="utf-8" ?>';
$xml .= PHP_EOL . '<metadata>';
$xml .= PHP_EOL . $this->_t(1) . '<layout title="' . $lang . '_TITLE" option="' . $lang . '_OPTION">';
$xml .= PHP_EOL . $this->_t(2) . '<message>';
$xml .= PHP_EOL . $this->_t(3) . '<![CDATA[' . $lang . '_DESC]]>';
$xml .= PHP_EOL . $this->_t(2) . '</message>';
$xml .= PHP_EOL . $this->_t(1) . '</layout>';
$xml .= PHP_EOL . '</metadata>';
}
return $xml;
}
public function setCustomViewMenu(&$view)
{
$xml = '';

View File

@ -248,7 +248,7 @@ class Infusion extends Interpretation
$this->setViewPlaceholders($view['settings']);
// set site edit view array
if (isset($view['edit_create_site_view']) && $view['edit_create_site_view'])
if (isset($view['edit_create_site_view']) && is_numeric($view['edit_create_site_view']) && $view['edit_create_site_view'] > 0)
{
$site_edit_view_array[] = $this->_t(4) . "'" . $viewName_single . "'";
$this->lang = 'both';
@ -357,9 +357,15 @@ class Infusion extends Interpretation
$this->fileContentDynamic[$viewName_single][$this->hhh . 'VIEWCSS' . $this->hhh] = $this->getCustomScriptBuilder('css_view', $viewName_single, '', null, true);
// add css to front end
if (isset($view['edit_create_site_view']) && $view['edit_create_site_view'])
if (isset($view['edit_create_site_view']) && is_numeric($view['edit_create_site_view']) && $view['edit_create_site_view'] > 0)
{
$this->fileContentDynamic[$viewName_single][$this->hhh . 'SITE_VIEWCSS' . $this->hhh] = $this->fileContentDynamic[$viewName_single][$this->hhh . 'VIEWCSS' . $this->hhh];
// check if we should add a create menu
if ($view['edit_create_site_view'] == 2)
{
// SITE_MENU_XML <<<DYNAMIC>>>
$this->fileContentDynamic[$viewName_single][$this->hhh . 'SITE_MENU_XML' . $this->hhh] = $this->setAdminViewMenu($viewName_single, $view);
}
}
}
// set the views names
@ -552,7 +558,7 @@ class Infusion extends Interpretation
}
$this->fileContentStatic[$this->hhh . 'ROUTEHELPER' . $this->hhh] .= $this->setRouterHelp($viewName_single, $viewName_list);
if (isset($view['edit_create_site_view']) && $view['edit_create_site_view'])
if (isset($view['edit_create_site_view']) && is_numeric($view['edit_create_site_view']) && $view['edit_create_site_view'] > 0)
{
// add needed router stuff for front edit views
$this->fileContentStatic[$this->hhh . 'ROUTER_PARSE_SWITCH' . $this->hhh] .= $this->routerParseSwitch($viewName_single, null, false);