public function PullForm::buildForm in Entity Share 8
Same name and namespace in other branches
- 8.3 modules/entity_share_client/src/Form/PullForm.php \Drupal\entity_share_client\Form\PullForm::buildForm()
- 8.2 modules/entity_share_client/src/Form/PullForm.php \Drupal\entity_share_client\Form\PullForm::buildForm()
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides FormInterface::buildForm
File
- modules/
entity_share_client/ src/ Form/ PullForm.php, line 137
Class
- PullForm
- Form controller to pull entities.
Namespace
Drupal\entity_share_client\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form['remote'] = [
'#type' => 'select',
'#title' => $this
->t('Remote website'),
'#options' => $this
->prepareRemoteOptions(),
'#default_value' => $this->query
->get('remote'),
'#empty_value' => '',
'#required' => TRUE,
'#ajax' => [
'callback' => [
get_class($this),
'buildAjaxChannelSelect',
],
'wrapper' => 'channel-wrapper',
'method' => 'replace',
'effect' => 'fade',
],
];
// Container for the AJAX.
$form['channel_wrapper'] = [
'#type' => 'container',
// Force an id because otherwise default id is changed when using AJAX.
'#attributes' => [
'id' => 'channel-wrapper',
],
];
$this
->buildChannelSelect($form, $form_state);
return $form;
}