Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
831 views
in Plugins by
edited by

This is just a question of aesthetics, I'd like to have a separator in one of my plugin's admin options.

How would one do this in a succinct way?


Edit : 

This is the code for 2 options, for example :

$fields = array();
$fields[] = array(
'label' => 'Enable insert menu',
'tags' => 'NAME="image_upload"',
'value' => qa_opt('image_upload'),
'type' => 'checkbox',
);
$fields[] = array(
'label' => 'Show save option',
'tags' => 'NAME="save"',
'value' => qa_opt('save'),
'type' => 'checkbox',
);   
 
// Return full admin form           
return array(           
'ok' => ($ok && !isset($error)) ? $ok : null,
'fields' => $fields,
'buttons' => array(
array(
'label' => 'Save',
'tags' => 'NAME="admin_save"',
),
array(
'label' => 'Reset',
'tags' => 'NAME="admin_reset"',
)
),
);
 
Between the 2 options in $fields I want to add a third option that simply adds a separator, a horizontal line. Simply looking for a succinct way to do this ...
Q2A version: 1.6.3
by
I guess you mean there are 2 options in the admin options of the plugin and you want both of them to have a separator between them. Can you point to the plugin's code (assuming it is on github)?
by
I edited the question for more details, it's not a very important question but I'm just curious to see what answers might pop up.

2 Answers

+1 vote
by
selected by
 
Best answer
These separators are already implemented. They are the type blank. In order to add one you should do something like this:
 
$fields[] = array(
    'type' => 'blank'
);
 
It is important to note that they 100% depend on the theme you're using. Some of them use an <hr> and some just a whitespace (such as SnowFlat).
by
k thanks man, very helpful!
0 votes
by

I just added this field :

$fields[] = array(
'label' => '<hr><br><small>wowow!!!</small>',
'type' => 'custom',
 );
 
and that worked ... not sure why lol
...