?
avatar motokraft
motokraft
4 May 2018

Здравствуйте!
Есть пару моментов которые хотелось бы исправить в ближайших версиях.

  1. Судя по файлу administrator\components\com_menus\models\items.php в функции preprocessForm нет обработки плагина. Из-за этого нельзя добавить параметр в фильтр этой страницы.

  2. Сделайте так, что бы можно было переопределять не только файл default.php но и все файлы которые начинаются на view (view.html.php, view.json.php, view.row.php).

  3. Сделайте общее событие плагина (к примеру onContentDBQuery($context, $query, $db)). В этом событии можно будет изменять SQL запрос для своих нужд, что бы не лазить в ядре...


Google Translate (ru => en)

Minor improvements and changes to v3.x.x

Hello!
There are a couple of points that I would like to correct in the next versions.

Judging by the file administrator \ components \ com_menus \ models \ items.php in the function preprocessForm there is no processing plug-in. Because of this, you can not add a parameter to the filter on this page.

Do this so that you can redefine not only the default.php file but also all the files that start on view (view.html.php, view.json.php, view.row.php).

Make a general plug-in event (for example onContentDBQuery ($ context, $ query, $ db)). In this event, you can change the SQL query for your needs, that would not climb in the kernel ...

avatar motokraft motokraft - open - 4 May 2018
avatar joomla-cms-bot joomla-cms-bot - change - 4 May 2018
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 4 May 2018
avatar mbabker
mbabker - comment - 4 May 2018

Responding based on the Google translation for this:

For item 2, there is already a addViewPath method in controllers which lets you define additional filesystem paths to search for view classes. Beyond that, our API does not explicitly support overloading classes because this can (and will) cause problems with upgrades down the road, not to mention the inability to rely on a class being in a known state.

For item 3, we do not have events in core which allows general query manipulation and we will not be adding these. That is just asking for too much trouble.

avatar franz-wohlkoenig franz-wohlkoenig - change - 4 May 2018
Status New Discussion
avatar franz-wohlkoenig franz-wohlkoenig - change - 4 May 2018
Category com_menus
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 4 May 2018

@motokraft can you please translate in English so other can understand this issue?

avatar zero-24 zero-24 - change - 4 May 2018
Title
Небольшие улучшения и изменения v3.x.x
Minor improvements and changes to v3.x.x / Небольшие улучшения и изменения v3.x.x
avatar zero-24 zero-24 - edited - 4 May 2018
avatar zero-24 zero-24 - change - 4 May 2018
The description was changed
avatar zero-24 zero-24 - edited - 4 May 2018
avatar zero-24
zero-24 - comment - 4 May 2018

Just done that with GT ;) But the points by michael still stands.

avatar motokraft
motokraft - comment - 5 May 2018

It is not clear what you meant!
Will these changes be in test versions?

avatar zero-24
zero-24 - comment - 5 May 2018

Do this so that you can redefine not only the default.php file but also all the files that start on view (view.html.php, view.json.php, view.row.php).

Use the addViewPath method in the controller ;)

Make a general plug-in event (for example onContentDBQuery ($ context, $ query, $ db)). In this event, you can change the SQL query for your needs, that would not climb in the kernel ...

There are no intentions to do this as this is calling for trouble.

avatar motokraft
motokraft - comment - 5 May 2018

this method is only available on the controller?
Can I call the addViewPath method from the plugin?

avatar mbabker
mbabker - comment - 5 May 2018

Yes. But you have to be very careful with this because the calls to JControllerLegacy::getInstance() create a singleton instance and can mess up a component if not handled correctly. You will need a system plugin hooking the onAfterRoute event, this code example should work for com_content:

public function onAfterRoute()
{
    $option = JFactory::getApplication()->input->getCmd('option');

    switch ($option) {
        case 'com_content':
            $controller = JControllerLegacy::getInstance('Content');
            $controller->addViewPath('/path/to/my/custom/views');

            break;
    }
}
avatar motokraft
motokraft - comment - 5 May 2018

and it is not easier to add a system plug-in event to the controller?

avatar Septdir
Septdir - comment - 5 May 2018

@motokraft

  1. Indeed, in this model there are no triggers, one why he is needed there. Perhaps you want to make some useful filter and it should be added to core

  2. What is the point? layout is enough, you can output the content as you like, in any format. Well at most, override controller.

  3. It has already been many times. There will not be such. This is not com_k2. If you need to change the query, override model or create new component. If you add an event, the consequences can be too unpredictable

avatar motokraft
motokraft - comment - 10 May 2018

Okay! Good. Let's leave the controller alone and take care of the view itself, namely the files view.*.php.
You can do this so that you can redefine them as well as the default.php files

avatar Septdir
Septdir - comment - 11 May 2018

@motokraft I can not understand why you need to override the view.php entirely. You can tell more.

avatar motokraft
motokraft - comment - 12 May 2018

I make a template and I want to do on all pages where there is a table to use https://datatables.net/ together with ajax, but for this it is necessary to redefine the file view.html.php for each component and create a new file view.json.php

avatar Septdir
Septdir - comment - 14 May 2018

@motokraft You can use layout override & com_ajax with template helper. For this task, you do not need to override or create new view. This is if we are talking about templates.

If to speak about components as a whole for json it is better to use the controller with JResponseJson

avatar Quy Quy - change - 18 May 2018
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2018-05-18 22:59:35
Closed_By Quy
avatar joomla-cms-bot joomla-cms-bot - change - 18 May 2018
Closed_By Quy joomla-cms-bot
avatar joomla-cms-bot joomla-cms-bot - close - 18 May 2018
avatar joomla-cms-bot
joomla-cms-bot - comment - 18 May 2018

Set to "closed" on behalf of @Quy by The JTracker Application at issues.joomla.org/joomla-cms/20300

avatar Quy
Quy - comment - 18 May 2018

Closing as it appears this issue has been answered.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20300.

Add a Comment

Login with GitHub to post a comment