Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2014-12-31 08:43:07

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,599
GitHub Twitter

text_input position parameter for prefs page

Hey guys.

I need documentation on the “position” parameter for the creation of text_input into the page prefs.
Where can I find it?

Best regards,


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#2 2014-12-31 09:46:42

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

Re: text_input position parameter for prefs page

Pat64 wrote #286963:

I need documentation on the “position” parameter for the creation of text_input into the page prefs.

I’m not sure there’s any official documentation on it. But generally, you use it to determine the order things appear within each group. Lower numbers appear first (higher up the page).

You’ll notice that we often leave gaps between successive entries (e.g. a spacing of 10 or so) which allows us to more easily insert entries later without altering more rows than necessary. Not a huge problem if not, it’s just less work to add one row than it is to add the row and increment everything after it as well.

Hope that helps.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2014-12-31 12:20:26

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,599
GitHub Twitter

Re: text_input position parameter for prefs page

Yep. Tks Mr Bloke ;)

So, what is your advice? I need to add an entry just after the rvm_css_directory (for example).
Do you think a 20 position is good?

(Is there a programming way to avoid conflicts with existant ones?)

Best regards,

Last edited by Pat64 (2014-12-31 12:23:49)


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#4 2014-12-31 12:33:14

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

Re: text_input position parameter for prefs page

Pat64 wrote #286972:

So, what is your advice? I need to add an entry just after the rvm_css_directory (for example).

Pick a number higher than Ruud chose and lower than the next item in the list ;-) If someone else writes a plugin that puts something in between, and you feel strongly about it, you’ll have to update your plugin to put yours back where you think it needs to be. There’s no easy way to determine if a slot is “taken” short of querying the txp_prefs table.

Alternatively, create your own prefixed group for your plugin’s prefs, then you have complete control over the order inside that group.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#5 2014-12-31 12:38:23

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,599
GitHub Twitter

Re: text_input position parameter for prefs page

Yeah. Very interesting ;)

Stef, what is the maximum number for this part of text input group?

/**
 * Plugin prefs: entry for cache dir.
 *
 */
function pat_article_social_prefs()
{
	global $textarray;
	$textarray['pat_article_social_dir'] = 'Cache directory';
	if (!safe_field ('name', 'txp_prefs', "name='pat_article_social_dir'"))
		safe_insert('txp_prefs', "prefs_id=1, name='pat_article_social_dir', val='cache', type=1, event='admin', html='text_input', position=21");
	safe_repair('txp_plugin');
}

Last edited by Pat64 (2014-12-31 12:41:32)


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#6 2014-12-31 14:03:35

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

Re: text_input position parameter for prefs page

Pat64 wrote #286975:

what is the maximum number for this part of text input group?

65535. Plenty of wiggle room.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#7 2014-12-31 14:47:00

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,599
GitHub Twitter

Re: text_input position parameter for prefs page

:D :D :D

Thanks lot Stef for your help.

I wish you a happy new year.


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

Board footer

Powered by FluxBB