Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.0] Add next PATH to override other components layouts #32720

Closed
variax73 opened this issue Mar 17, 2021 · 6 comments
Closed

[4.0] Add next PATH to override other components layouts #32720

variax73 opened this issue Mar 17, 2021 · 6 comments

Comments

@variax73
Copy link

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

@brianteeman
Copy link
Contributor

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

Why not

@variax73
Copy link
Author

variax73 commented Mar 17, 2021 via email

@dgrammatiko
Copy link
Contributor

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

@variax73
Copy link
Author

variax73 commented Mar 19, 2021 via email

@ghost
Copy link

ghost commented Apr 9, 2021

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

@variax73 variax73 changed the title Add next PATH to override other components layouts [4.0] Add next PATH to override other components layouts Apr 9, 2021
@Hackwar
Copy link
Member

Hackwar commented Dec 6, 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.

@Hackwar Hackwar closed this as completed Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants