No Code Attached Yet
avatar variax73
variax73
17 Mar 2021

Is your feature request related to a problem? Please describe.

I need to override in my developed component layout from other component (E.G. "com_categories"). I know there is possiblity in global template but this is not realy usefull.

Describe the solution you'd like

Please add in standard list PATH to override, one more PATH, to developed component. Now the list looks like thiis:
'..\administrator\templates/atum/html/layouts/com_categories'
'..\administrator/components/com_categories/layouts'
'..\administrator\templates/atum/html/layouts'
'../layouts'
I need a list like this:
'..\administrator/components/com_MyComponent/layouts'
'..\administrator\templates/atum/html/layouts/com_categories'
'..\administrator/components/com_categories/layouts'
'..\administrator\templates/atum/html/layouts'
'../layouts'
Name of new component can be taken from URL's extension like this:
.../index.php?option=com_categories&extension=com_MyComponent.itemstype&layout=itemstype

Alternative solution is adding function to registration of the new PATH in initialisation or better instalation of a new component.

Additional context

avatar variax73 variax73 - open - 17 Mar 2021
avatar joomla-cms-bot joomla-cms-bot - change - 17 Mar 2021
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 17 Mar 2021
avatar brianteeman
brianteeman - comment - 17 Mar 2021

I know there is possiblity in global template but this is not realy usefull.

Why not

avatar variax73
variax73 - comment - 17 Mar 2021

Because, in my opinion:

  • when Administrator adds new template and marks it as default - layouts
    overriding is lost;
  • there is a need to implements special procedures to install and uninstall
    overridden layouts;
  • this is complementary to layouts overriding mechanisms for system's
    layouts (E.G.
    "administrator\components\com_associations\layouts\joomla\searchtools\default.php"
    or
    "administrator\components\com_modules\layouts\joomla\form\field\modulespositionedit.php")

https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail
Wolny
od wirusów. www.avast.com
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

śr., 17 mar 2021 o 18:22 Brian Teeman @.***> napisał(a):

I know there is possiblity in global template but this is not realy
usefull.

Why not


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#32720 (comment),
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AO2O2WOYKOQLM2G7PJSUSHTTEDP7HANCNFSM4ZK65KVA
.

--

Maciej Bednarski

avatar dgrammatiko
dgrammatiko - comment - 18 Mar 2021

So, since you already coded your component then why don't you implement that yourself, eg

$vType = JFactory::getDocument()->getType();
$vName = $this->input->get('view', 'media');
switch ($vName)
{
case 'images':
$vLayout = $this->input->get('layout', 'default', 'string');
$mName = 'manager';
break;
case 'imagesList':
$mName = 'list';
$vLayout = $this->input->get('layout', 'default', 'string');
break;
case 'mediaList':
$app = JFactory::getApplication();
$mName = 'list';
$vLayout = $app->getUserStateFromRequest('media.list.layout', 'layout', 'thumbs', 'word');
break;
case 'media':
default:
$vName = 'media';
$vLayout = $this->input->get('layout', 'default', 'string');
$mName = 'manager';
break;
}
// Get/Create the view
$view = $this->getView($vName, $vType, '', array('base_path' => JPATH_COMPONENT_ADMINISTRATOR));

There's nothing missing from the API's perspective that stops you doing whatever you want with your layouts

avatar variax73
variax73 - comment - 19 Mar 2021

Again. In Joomla4 I want to use the 'com_category' component in my programmable component (com_myComponent). In the manifest file, I create a menu item:
"...

COM_MYCOMPONENT_ITEMS_TYPE ... ". This entry calls com_categories with its own layout files. The question is, how can I overwrite or add new layout files to com_categories? I know I can use Templates overwrite, but it's not very elegant. The administrator can always change the Template, delete it. In addition, such an overwritten template will probably be visible globally for all components and users. As a developer of com_myComponents, I have no control over it. In my opinion, the problem would be solved by adding an additional PATH pointing to the directory: './administrator/components/com_myComponent/layouts' in the "getDefaultIncludePaths" method of the "FileLayout" class. The "FileLayout:: getDefaultIncludePaths ()" method could get information about the component calling component 'com_categories' from the URL from the parameter 'extension'. Another solution may be that the component ('com_myComponent') can register a new PATH to the standard PATH list. What do I need this for? I want to be able to list the categories ('com_myComponent.itemstype') added to my component in a simplified way by adding additional specific information. I want to add an additional tab in the "edit.php" layout in which the user will enter additional information. Maybe the above can be achieved in another way? Please give me a tip.
avatar sandramay0905
sandramay0905 - comment - 9 Apr 2021

@variax73 please start the title using "[4.0] " as this issue seems for joomla 4, if i understand correct.

avatar variax73 variax73 - change - 9 Apr 2021
Title
Add next PATH to override other components layouts
[4.0] Add next PATH to override other components layouts
avatar variax73 variax73 - edited - 9 Apr 2021
avatar Hackwar
Hackwar - comment - 6 Dec 2022

You can add a category.xml to your component backend to extend the form and add additional fields to com_categories. That should solve for issue.

We will not add such an additional path for overrides to the CMS. You should not modify one component from another component.

avatar Hackwar Hackwar - change - 6 Dec 2022
Status New Closed
Closed_Date 0000-00-00 00:00:00 2022-12-06 21:47:34
Closed_By Hackwar
Labels Added: No Code Attached Yet
Removed: ?
avatar Hackwar Hackwar - close - 6 Dec 2022

Add a Comment

Login with GitHub to post a comment