Skip to content
This repository has been archived by the owner on Jan 5, 2018. It is now read-only.

Commit

Permalink
Issue #2671914: Implement EB configuration UI
Browse files Browse the repository at this point in the history
  • Loading branch information
primsi committed Feb 19, 2016
1 parent 62f7b78 commit 0db207c
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,4 +211,20 @@ protected function validateExtension($filename, $extensions) {
return TRUE;
}

/**
* {@inheritdoc}
*/
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$configuration = $this->getConfiguration();
$settings = $configuration['settings'];
$form += parent::buildConfigurationForm($form, $form_state);

$form['dropzone_description'] = [
'#type' => 'textfield',
'#title' => $this->t('Dropzone drag-n-drop zone text'),
'#default_value' => $settings['dropzone_description'],
];

return $form;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,39 @@ public function submit(array &$element, array &$form, FormStateInterface $form_s
$this->clearFormValues($element, $form_state);
}
}

/**
* {@inheritdoc}
*/
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$configuration = $this->getConfiguration();
$settings = $configuration['settings'];
$form += parent::buildConfigurationForm($form, $form_state);

$options = [];
$media_bundles = $this->entityManager->getBundleInfo('media');
if (!empty($media_bundles)) {
foreach ($media_bundles as $id => $bundle) {
$options[$id] = $bundle['label'];
}
$disabled = FALSE;
$description = $this->t('Select the type of media entity that you want to create from the uploaded files.');
}
else {
$disabled = TRUE;
$description = $this->t('You must create a media bundle before using this widget.');
}

$form['dropzonejs_media_entity'] = [
'#type' => 'select',
'#title' => $this->t('Media bundle to create'),
'#default_value' => $settings['dropzonejs_media_entity'],
'#description' => $description,
'#options' => $options,
'#disabled' => $disabled,
'#required' => TRUE,
];

return $form;
}
}

0 comments on commit 0db207c

Please sign in to comment.