Settings page integration

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest. | Game Memorial

live627

  • Should five per cent appear too small / Be thankful I don't take it all / 'Cause I'm the taxman, yeah I'm the taxman
  • Posts: 1,670
A confident man keeps quiet.whereas a frightened man keeps talking, hiding his fear.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278

live627

  • Should five per cent appear too small / Be thankful I don't take it all / 'Cause I'm the taxman, yeah I'm the taxman
  • Posts: 1,670
Re: Settings page integration
« Reply #33, on March 13th, 2012, 02:26 AM »
No, same file as in the revision, there's a small regex hack that allegedly converts the div in the label to  the subtext.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Settings page integration
« Reply #34, on March 13th, 2012, 02:37 AM »
Not in ManageSettings.php there isn't.

There is however in ManageServer.php:
Code: [Select]
// !!! Temporary. Preventing divs inside label tags.
$divPos = strpos($context['config_vars'][$config_var[1]]['label'], '<div');
if ($divPos !== false)
{
$context['config_vars'][$config_var[1]]['subtext'] = preg_replace('~</?div[^>]*>~', '', substr($context['config_vars'][$config_var[1]]['label'], $divPos));
$context['config_vars'][$config_var[1]]['label'] = substr($context['config_vars'][$config_var[1]]['label'], 0, $divPos);
}

Until everything that should be a subtext is a subtext, it needs to stay (though I think it's broken anyway... since I think everything's dfn tags now)

live627

  • Should five per cent appear too small / Be thankful I don't take it all / 'Cause I'm the taxman, yeah I'm the taxman
  • Posts: 1,670
Re: Settings page integration
« Reply #35, on March 13th, 2012, 07:03 AM »
Can you add  support for the callback type? Just need  to add a case for it in the top group.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Settings page integration
« Reply #36, on March 13th, 2012, 09:12 AM »
No, I won't.

In order to make it work, it would require not only having support for the type directly (which is an easy matter, though also requires updating the plugin-info.rng file), but the ability to load a source file and a template file, and call functions to load and save the data.

If it's that complex, do it the older way and create your own settings page through the normal hook channels.

Dragooon

  • I can code! Really!
  • polygon.com has to be one of the best sites I've seen recently.
  • Posts: 1,841
The way it's meant to be

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Settings page integration
« Reply #39, on March 20th, 2012, 02:43 PM »
Quote from Dragooon on March 20th, 2012, 02:38 PM
Hey, this actually works! :D. Great!
What do you mean 'this actually works'? :lol: Cheeky. Of course it works! :P (Never mind that as soon as I implemented it, I migrated all my simple plugins to use it, to prove it worked :P)

Dragooon

  • I can code! Really!
  • polygon.com has to be one of the best sites I've seen recently.
  • Posts: 1,841
Re: Settings page integration
« Reply #40, on March 20th, 2012, 03:01 PM »
You know.....I didn't expect this to be implemented, let alone working just fine...I just realised that you actually went ahead with it and dropped the admin area hooks :P

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Settings page integration
« Reply #41, on March 20th, 2012, 03:08 PM »
No, I didn't drop any hooks at all, this is in addition to it. (And I did mention in reply #30 that I'd added it :P)

The idea is that simple stuff can use the quick integration and have it basically done for them, but complex stuff (calendar, WedgeDesk) will still continue to do its own thing anyway. That's really what stuff like this is for: simple cases now don't have to create a new file just to store a function just to add to a variable, nor do they have to attach that function to hooks (especially re admin search).

There are also usability matters at hand: the more that Wedge can do automatically, the better everyone is. If plugin authors don't have to contend with plugins being integrated into search, because Wedge can do it for them, great - both the plugin author and the general users benefit. Also having a semi-consistent interface will help with that, instead of having to mess around adding new pages to the admin, they get added automatically so admins are going to be able to find them more easily :)

Dragooon

  • I can code! Really!
  • polygon.com has to be one of the best sites I've seen recently.
  • Posts: 1,841
Re: Settings page integration
« Reply #42, on March 20th, 2012, 03:12 PM »
I don't happen to be a good reader :P. I bumped into this while trying to figure out where to add the settings. Regardless, it's a pretty handy feature for quickly adding in a neat settings page. Thanks :).

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Settings page integration
« Reply #43, on March 20th, 2012, 03:14 PM »
Anytime :)

You probably figured by now, though, a lot of the way the plugin system is developing is actually because I've been using it. The <actions> hook for example is because I was actively adding actions and figuring out how awkward it was. This is another example. I did also suggest something similar for adding menu items actually... haven't got round to that yet.

live627

  • Should five per cent appear too small / Be thankful I don't take it all / 'Cause I'm the taxman, yeah I'm the taxman
  • Posts: 1,670