|
|
@ -27,18 +27,6 @@ class RoblibIllLoanForm extends FormBase { |
|
|
|
return $this->ill_auth_form($form, $form_state); |
|
|
|
return $this->ill_auth_form($form, $form_state); |
|
|
|
} |
|
|
|
} |
|
|
|
return $this->ill_request_form($form, $form_state); |
|
|
|
return $this->ill_request_form($form, $form_state); |
|
|
|
|
|
|
|
|
|
|
|
/* $values = $form_state->getValues(); |
|
|
|
|
|
|
|
if (empty($values)) { |
|
|
|
|
|
|
|
$form_name = 'upei_roblib_ill_request_form'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
$form_name = 'upei_roblib_ill_auth_form'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$form_state->setValue('step', $from_name); |
|
|
|
|
|
|
|
return $form_name === 'upei_roblib_ill_request_form' ? $this->ill_request_form($form, $form_state) : |
|
|
|
|
|
|
|
$this->ill_auth_form($form, $form_state); |
|
|
|
|
|
|
|
* */ |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -72,9 +60,10 @@ class RoblibIllLoanForm extends FormBase { |
|
|
|
$form_state->set('aid', $aid); |
|
|
|
$form_state->set('aid', $aid); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
//if (empty($form_state->get('step')) && $form_state['triggering_element']['#value'] !== 'Lookup DOI' && empty($form_state->get('Title'))) { |
|
|
|
$trigger = $form_state->getTriggeringElement(); |
|
|
|
// form_set_error('Title', t('Journal/Book Title is required.')); |
|
|
|
if (empty($form_state->get('step')) && $trigger['#value'] !== 'Lookup DOI' && empty($form_state->getValue('Title'))) { |
|
|
|
//} |
|
|
|
$form_state->setErrorByName('Title', t('Journal/Book Title is required.')); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -96,11 +85,14 @@ function ill_form_message_id($id) { |
|
|
|
* The current state of the form. |
|
|
|
* The current state of the form. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function submitStepOne(array &$form, FormStateInterface $form_state) { |
|
|
|
public function submitStepOne(array &$form, FormStateInterface $form_state) { |
|
|
|
|
|
|
|
$trigger = $form_state->getTriggeringElement(); |
|
|
|
|
|
|
|
if ($trigger['#value'] != 'Lookup DOI') { |
|
|
|
$form_state |
|
|
|
$form_state |
|
|
|
->set('step', 2) |
|
|
|
->set('step', 2) |
|
|
|
->set('request', $form_state->getValues()) |
|
|
|
->set('request', $form_state->getValues()) |
|
|
|
->setRebuild(TRUE); |
|
|
|
->setRebuild(TRUE); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* {@inheritdoc} |
|
|
|
* {@inheritdoc} |
|
|
@ -122,6 +114,13 @@ function ill_form_message_id($id) { |
|
|
|
]; */ |
|
|
|
]; */ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function doiCallback(array &$form, FormStateInterface $form_state) { |
|
|
|
|
|
|
|
module_load_include('inc', 'upei_roblib_ill', 'includes/doi'); |
|
|
|
|
|
|
|
$doi = $form_state->getValue('doi'); |
|
|
|
|
|
|
|
$form = upei_roblib_ill_doi_get_data($form, $doi); |
|
|
|
|
|
|
|
return $form; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* The bibliographic portion of the ILL form. |
|
|
|
* The bibliographic portion of the ILL form. |
|
|
|
* |
|
|
|
* |
|
|
@ -177,7 +176,7 @@ function ill_form_message_id($id) { |
|
|
|
'#type' => 'submit', |
|
|
|
'#type' => 'submit', |
|
|
|
'#value' => 'Lookup DOI', |
|
|
|
'#value' => 'Lookup DOI', |
|
|
|
'#ajax' => [ |
|
|
|
'#ajax' => [ |
|
|
|
'callback' => 'upei_roblib_ill_doi_callback', |
|
|
|
'callback' => '::doiCallback', |
|
|
|
'method' => 'replace', |
|
|
|
'method' => 'replace', |
|
|
|
'wrapper' => 'upei-roblib-ill-request-form', |
|
|
|
'wrapper' => 'upei-roblib-ill-request-form', |
|
|
|
'effect' => 'fade', |
|
|
|
'effect' => 'fade', |
|
|
|