public function sbo__relationship::instanceSettingsForm
3.x sbo__relationship.inc | public sbo__relationship::instanceSettingsForm() |
Overrides ChadoField::instanceSettingsForm
See also
File
- tripal_chado/
includes/ TripalFields/ sbo__relationship/ sbo__relationship.inc, line 593
Class
Code
public function instanceSettingsForm() {
$element = parent::instanceSettingsForm();
$element['items_per_page'] = array(
'#type' => 'textfield',
'#title' => 'Items per Page',
'#description' => t('The number of items that should appear on each page. A pager is provided if more than this number of items exist.'),
'#default_value' => $this->instance['settings']['items_per_page'],
);
//$element = parent::instanceSettingsForm();
$element['relationships'] = array(
'#type' => 'fieldset',
'#title' => 'Allowed Relationship Types',
'#description' => t('There are three ways that relationship types
can be limited for users who have permission to add new relationships.
Please select the most appropriate for you use case. By default
all vocabularies are provided to the user which allows use of any
term for the relationship type.'),
'#collapsed' => TRUE,
'#collapsible' => TRUE,
);
// $element['instructions'] = array(
// '#type' => 'item',
// '#markup' => 'You may provide a list of terms that will be available in a select box
// as the relationship types. This select box will replace the vocabulary select box if the
// following value is set.'
// );
$vocs = chado_get_cv_select_options();
$element['relationships']['option1'] = array(
'#type' => 'item',
'#title' => 'Option #1',
'#description' => t('Use this option to limit the vocabularies that a user .
could use to specify relationship types. With this option any term in .
the vocabulary can be used for the relationship type. You may select
more than one vocabulary.'),
);
$element['relationships']['option1_vocabs'] = array(
'#type' => 'select',
'#multiple' => TRUE,
'#options' => $vocs,
'#size' => 6,
'#default_value' => $this->instance['settings']['relationships']['option1_vocabs'],
// TODO add ajax here so that the relationship autocomplete below works
);
$element['relationships']['option2'] = array(
'#type' => 'item',
'#title' => '<b>Option #2</b>',
'#description' => 'Some vocabularies are heirarchichal (an ontology). Within this
heirarchy groups of related terms typically fall under a common parent. If you
wish to limit the list of terms that a user can use for the relationship type,
you can provide the parent term here. Then, only that term\'s children will
be avilable for use as a relationship type.',
);
$element['relationships']['option2_vocab'] = array(
'#type' => 'select',
'#description' => 'Specify Default Vocabulary',
'#multiple' => FALSE,
'#options' => $vocs,
'#default_value' => $this->instance['settings']['relationships']['option2_vocab'],
'#ajax' => array(
'callback' => "sbo__relationship_instance_settings_form_ajax_callback",
'wrapper' => 'relationships-option2-parent',
'effect' => 'fade',
'method' => 'replace'
),
);
$element['relationships']['option2_parent'] = array(
'#type' => 'textfield',
'#description' => 'Specify a Heirarchical Parent Term',
'#default_value' => $this->instance['settings']['relationships']['option2_parent'],
'#autocomplete_path' => "admin/tripal/storage/chado/auto_name/cvterm/",
'#prefix' => '<div id=relationships-option2-parent>',
'#suffix' => '</div>'
);
$element['relationships']['option3'] = array(
'#type' => 'item',
'#title' => 'Option #3',
'#description' => 'Provide terms separated by a new line. The term provided should be
unique and distinguishable by the name. You can use a bar | to separate a vocabulary
and a term to allow more specific assignment.',
);
$element['relationships']['relationship_types'] = array(
'#type' => 'textarea',
'#default_value' => $this->instance['settings']['relationships']['relationship_types'],
);
return $element;
}