|
@@ -35,12 +35,22 @@ class sbo__relationship extends ChadoField {
|
|
|
// type. This will create form elements when editing the field instance
|
|
|
// to allow the site admin to change the term settings above.
|
|
|
'term_fixed' => FALSE,
|
|
|
+ // Inidates if this field should be automatically attached to display
|
|
|
+ // or web services or if this field should be loaded separately. This
|
|
|
+ // is convenient for speed. Fields that are slow should for loading
|
|
|
+ // should ahve auto_attach set to FALSE so tha their values can be
|
|
|
+ // attached asyncronously.
|
|
|
+ 'auto_attach' => FALSE,
|
|
|
+ // Settings to help the site admin control how relationship types and
|
|
|
+ // valid subject/objects can be selected by the user.
|
|
|
'relationships' => array(
|
|
|
'option1_vocabs' => '',
|
|
|
'option2_vocab' => '',
|
|
|
'option2_parent' => '',
|
|
|
'relationship_types' => '',
|
|
|
),
|
|
|
+ // The number of items to show on a page.
|
|
|
+ 'items_per_page' => 10,
|
|
|
);
|
|
|
|
|
|
// The default widget for this field.
|
|
@@ -175,11 +185,6 @@ class sbo__relationship extends ChadoField {
|
|
|
if (array_key_exists('rank', $schema['fields'])) {
|
|
|
$options['order_by'] = array('rank' => 'ASC');
|
|
|
}
|
|
|
- // We want a pager for relationships.
|
|
|
- $options['pager'] = array(
|
|
|
- 'limit' => 25,
|
|
|
- 'element' => $this->getPagerElementID(),
|
|
|
- );
|
|
|
$record = chado_expand_var($record, 'table', $rel_table, $options);
|
|
|
if (!$record->$rel_table) {
|
|
|
return;
|
|
@@ -521,9 +526,16 @@ class sbo__relationship extends ChadoField {
|
|
|
*
|
|
|
* @see TripalField::settingsForm()
|
|
|
*/
|
|
|
- public function settingsForm($has_data) {
|
|
|
+ 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',
|
|
@@ -609,7 +621,7 @@ class sbo__relationship extends ChadoField {
|
|
|
* @param unknown $form
|
|
|
* @param unknown $form_state
|
|
|
*/
|
|
|
- public function settingsFormValidate($form, &$form_state) {
|
|
|
+ public function instanceSettingsFormValidate($form, &$form_state) {
|
|
|
// Get relationships settings
|
|
|
$settings = $form_state['values']['instance']['settings']['relationships'];
|
|
|
$form_state['values']['instance']['settings']['relationships']['relationship_types']= trim($settings['relationship_types']);
|