Release of v5.1.1-alpha3
Add edit and create options to the ModalSelect Field (in Joomla 5).
This commit is contained in:
@ -212,6 +212,15 @@ class ###View###Controller extends FormController
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
// When editing in modal then redirect to modalreturn layout
|
||||
elseif ($cancel && $this->input->get('layout') === 'modal')
|
||||
{
|
||||
$id = $this->input->get('id');
|
||||
$return = 'index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($id)
|
||||
. '&layout=modalreturn&from-task=cancel';
|
||||
|
||||
$this->setRedirect(Route::_($return, false));
|
||||
}###JCONTROLLERFORM_AFTERCANCEL###
|
||||
return $cancel;
|
||||
}
|
||||
@ -294,6 +303,15 @@ class ###View###Controller extends FormController
|
||||
* @since 11.1
|
||||
*/
|
||||
protected function postSaveHook(BaseDatabaseModel $model, $validData = [])
|
||||
{###POSTSAVEHOOK###
|
||||
{
|
||||
if ($this->input->get('layout') === 'modal' && $this->task === 'save')
|
||||
{
|
||||
// When editing in modal then redirect to modalreturn layout
|
||||
$id = $model->getState('###view###.id', '');
|
||||
$return = 'index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($id)
|
||||
. '&layout=modalreturn&from-task=save';
|
||||
|
||||
$this->setRedirect(Route::_($return, false));
|
||||
}###POSTSAVEHOOK###
|
||||
}
|
||||
}
|
||||
|
52
admin/compiler/joomla_4/ADMIN_VIEW_MODAL_RETURN.php
Normal file
52
admin/compiler/joomla_4/ADMIN_VIEW_MODAL_RETURN.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this JCB template file (EVER)
|
||||
defined('_JCB_TEMPLATE') or die;
|
||||
?>
|
||||
###BOM###
|
||||
|
||||
use Joomla\CMS\Router\Route;
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED###
|
||||
|
||||
/** @var \###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\View\###View###\HtmlView $this */
|
||||
|
||||
$icon = 'icon-check';
|
||||
$title_key = $this->item->###SQL_TITLE_KEY### ?? '';
|
||||
$title_column = $this->item->###SQL_TITLE_COLUMN### ?? '';
|
||||
$data = [
|
||||
'contentType' => 'com_###component###.###view###',
|
||||
'id' => $title_key,
|
||||
'title' => $title_column,
|
||||
'uri' => Route::_('index.php?option=com_###component###&layout=modal&tmpl=component&id='. (int) ($this->item->id ?? 0))
|
||||
];
|
||||
|
||||
// Add Content select script
|
||||
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
|
||||
$wa = $this->getDocument()->getWebAssetManager();
|
||||
$wa->useScript('modal-content-select');
|
||||
|
||||
// The data for Content select script
|
||||
$this->getDocument()->addScriptOptions('content-select-on-load', $data, false);
|
||||
|
||||
?>
|
||||
|
||||
<div class="px-4 py-5 my-5 text-center">
|
||||
<span class="fa-8x mb-4 <?php echo $icon; ?>" aria-hidden="true"></span>
|
||||
<h1 class="display-5 fw-bold"><?php echo $title_column; ?></h1>
|
||||
<div class="col-lg-6 mx-auto">
|
||||
<p class="lead mb-4">
|
||||
<?php echo $title_column; ?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
28
admin/compiler/joomla_4/SITE_ADMIN_VIEW_MODAL.php
Normal file
28
admin/compiler/joomla_4/SITE_ADMIN_VIEW_MODAL.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this JCB template file (EVER)
|
||||
defined('_JCB_TEMPLATE') or die;
|
||||
?>
|
||||
###BOM###
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED###
|
||||
|
||||
/** @var \###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\View\###View###\HtmlView $this */
|
||||
?>
|
||||
<div class="subhead noshadow mb-3">
|
||||
<?php echo $this->getDocument()->getToolbar('toolbar')->render(); ?>
|
||||
</div>
|
||||
<div class="container-popup">
|
||||
<?php $this->setLayout('edit'); ?>
|
||||
<?php echo $this->loadTemplate(); ?>
|
||||
</div>
|
52
admin/compiler/joomla_4/SITE_ADMIN_VIEW_MODAL_RETURN.php
Normal file
52
admin/compiler/joomla_4/SITE_ADMIN_VIEW_MODAL_RETURN.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this JCB template file (EVER)
|
||||
defined('_JCB_TEMPLATE') or die;
|
||||
?>
|
||||
###BOM###
|
||||
|
||||
use Joomla\CMS\Router\Route;
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED###
|
||||
|
||||
/** @var \###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\View\###View###\HtmlView $this */
|
||||
|
||||
$icon = 'icon-check';
|
||||
$title_key = $this->item->###SQL_TITLE_KEY### ?? '';
|
||||
$title_column = $this->item->###SQL_TITLE_COLUMN### ?? '';
|
||||
$data = [
|
||||
'contentType' => 'com_###component###.###view###',
|
||||
'id' => $title_key,
|
||||
'title' => $title_column,
|
||||
'uri' => Route::_('index.php?option=com_###component###&layout=modal&tmpl=component&id='. (int) ($this->item->id ?? 0))
|
||||
];
|
||||
|
||||
// Add Content select script
|
||||
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
|
||||
$wa = $this->getDocument()->getWebAssetManager();
|
||||
$wa->useScript('modal-content-select');
|
||||
|
||||
// The data for Content select script
|
||||
$this->getDocument()->addScriptOptions('content-select-on-load', $data, false);
|
||||
|
||||
?>
|
||||
|
||||
<div class="px-4 py-5 my-5 text-center">
|
||||
<span class="fa-8x mb-4 <?php echo $icon; ?>" aria-hidden="true"></span>
|
||||
<h1 class="display-5 fw-bold"><?php echo $title_column; ?></h1>
|
||||
<div class="col-lg-6 mx-auto">
|
||||
<p class="lead mb-4">
|
||||
<?php echo $title_column; ?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
@ -328,12 +328,6 @@
|
||||
"newName": "default.php",
|
||||
"type": "single"
|
||||
},
|
||||
"ADMIN_VIEW_MODAL.php": {
|
||||
"path": "c0mp0n3nt/admin/tmpl/[[[name]]]",
|
||||
"rename": "new",
|
||||
"newName": "modal.php",
|
||||
"type": "single"
|
||||
},
|
||||
"ADMIN_VIEW_MODEL.php": {
|
||||
"path": "c0mp0n3nt/admin/src/Model",
|
||||
"rename": "new",
|
||||
@ -392,12 +386,6 @@
|
||||
"newName": "default.php",
|
||||
"type": "list"
|
||||
},
|
||||
"ADMIN_VIEWS_MODAL.php": {
|
||||
"path": "c0mp0n3nt/admin/tmpl/[[[name]]]",
|
||||
"rename": "new",
|
||||
"newName": "modal.php",
|
||||
"type": "list"
|
||||
},
|
||||
"ADMIN_VIEWS_EMPTYSTATE.php": {
|
||||
"path": "c0mp0n3nt/admin/tmpl/[[[name]]]",
|
||||
"rename": "new",
|
||||
@ -482,6 +470,24 @@
|
||||
"newName": "ModalSelectField.php",
|
||||
"type": "fieldmodalselect_override"
|
||||
},
|
||||
"ADMIN_VIEWS_MODAL.php": {
|
||||
"path": "c0mp0n3nt/admin/tmpl/[[[name]]]",
|
||||
"rename": "new",
|
||||
"newName": "modal.php",
|
||||
"type": "list_modal"
|
||||
},
|
||||
"ADMIN_VIEW_MODAL.php": {
|
||||
"path": "c0mp0n3nt/admin/tmpl/[[[name]]]",
|
||||
"rename": "new",
|
||||
"newName": "modal.php",
|
||||
"type": "single_modal"
|
||||
},
|
||||
"ADMIN_VIEW_MODAL_RETURN.php": {
|
||||
"path": "c0mp0n3nt/admin/tmpl/[[[name]]]",
|
||||
"rename": "new",
|
||||
"newName": "modalreturn.php",
|
||||
"type": "single_modal"
|
||||
},
|
||||
"FORM_LIST_FIELD.php": {
|
||||
"path": "c0mp0n3nt/admin/src/Field",
|
||||
"rename": "new",
|
||||
@ -750,6 +756,18 @@
|
||||
"newName": "HtmlView.php",
|
||||
"type": "edit"
|
||||
},
|
||||
"SITE_ADMIN_VIEW_MODAL.php": {
|
||||
"path": "c0mp0n3nt/site/tmpl/[[[name]]]",
|
||||
"rename": "new",
|
||||
"newName": "modal.php",
|
||||
"type": "edit_modal"
|
||||
},
|
||||
"SITE_ADMIN_VIEW_MODAL_RETURN.php": {
|
||||
"path": "c0mp0n3nt/site/tmpl/[[[name]]]",
|
||||
"rename": "new",
|
||||
"newName": "modalreturn.php",
|
||||
"type": "edit_modal"
|
||||
},
|
||||
"view_site_edit.css": {
|
||||
"path": "c0mp0n3nt/site/assets/css",
|
||||
"rename": "view_site_edit",
|
||||
|
Reference in New Issue
Block a user