E107: Question: How is it possible to change default behavior on e.g. pages-update

Created on 24 Nov 2016  路  17Comments  路  Source: e107inc/e107

Hi,
how is it possible to change default behavior on e.g. pages-update? This means, if i'm change e.g. a custom page within admin menu that i don't go back to admin main menu.
At the end of editing screen i can choos the behavoir - but how can i change the default value from
"go to list" to "edit current"?

edit_default

documentation

Most helpful comment

I doubt many people will change the default option to be honest. But hey, I'm generally positive towards customisation possibilities 馃憤

All 17 comments

I think at the moment this is not possible, although if I remember correctly, @lonalore made some adjustments or flexibility improvements here? Maybe he can elaborate. I may be wrong though haha.

You can do it with e_admin.php addon file in a custom plugin. But this requires basic programming skills. Just create a custom plugin, and create e_admin.php file in its folder with these contents:

<?php

/**
 * @file
 * Addon file to hook into Admin UI.
 */


/**
 * Class YOURPLUGINNAME_admin.
 */
class YOURPLUGINNAME_admin
{

    /**
     * Extend Admin-ui Parameters.
     *
     * @param object $ui
     *  Admin UI object.
     *
     * @return array
     */
    public function config($ui)
    {
        $config = array();

        // Event name, e.g: 'wmessage', 'news' etc. (core or plugin).
        $type = $ui->getEventName();

        switch($type)
        {
            case 'page':
                $ui->setDefaultAction('edit');
                break;
        }

        return $config;
    }

}

Ok, sounds not as easy as supposed... :(
But thanks for that - is for me atm to much (not skilled as you)

Here you are. :) Just...

  • Unzip it
  • Copy plugin to your e107_plugins folder
  • Install it

customization.zip

Awesome - works.
But how i get the event name of every site where i would use this? (e.g. for media manager)?

If i change case 'page': to case '': this addon works for all sites in admin menu only or for the whole site (including frontend)?

Change case 'page': to default: and the "edit" will be set for each (Admin UI) form. There is no Admin UI on the frontend (if you mean the frontend as user area).

Perfect!
youare

@chimcen You would like your entire admin area to always default to 'Edit Current' ?

Normaly not - but i don't know all the page names i've want to - e.g. the media manager - all i've tryed didn't work at all...
I need only for:

  • Pages/Menu List = "page"
  • Newslist = "news"
  • Media Manager = "???"

but i don't know all the page names i've want to

Change

$type = $ui->getEventName();

to

$type = $ui->getEventName();
print_a($type);

Then a new box should appear on every admin page with the names you need.
After you found the names, either delete the newly added line or comment it out (by putting // in front of the line)

Thank you, this works - but not at every admin page there will be shown a extra box... e.g. on news list page or pages menu (and some others) it works, but on media manager there will be shown nothing... :(

news menu:
news

media manger:
mediamanager

It only works on the following pages:
ban
user
download
news
page
wmessage
comment

Media Manager does not use eventName. Try to use tableName instead:

$table = $ui->getTableName();

switch($table)
{
    case 'news': // News.
    case 'page': // Pages, Menu.
    case 'core_media': // Media manager.
        $ui->setDefaultAction('edit');
        break;
}

works! :) thank you :)

@lonalore @chimcen I'm just wondering if we should have a core pref to set the default throughout the entire admin area?

I doubt many people will change the default option to be honest. But hey, I'm generally positive towards customisation possibilities 馃憤

It is already quite complicated to use the Admin UI. Quite complex. In my opinion it's not necessary to provide a core pref for each of these kind of small customizations. Maybe a core plugin for it?

I agree. Maybe one customisation plugin where more advanced options can be selected.

Was this page helpful?
0 / 5 - 0 ratings