public function EmbedCode::getForm in Lightning Media 8.2
Same name and namespace in other branches
- 8.4 src/Plugin/EntityBrowser/Widget/EmbedCode.php \Drupal\lightning_media\Plugin\EntityBrowser\Widget\EmbedCode::getForm()
- 8 src/Plugin/EntityBrowser/Widget/EmbedCode.php \Drupal\lightning_media\Plugin\EntityBrowser\Widget\EmbedCode::getForm()
- 8.3 src/Plugin/EntityBrowser/Widget/EmbedCode.php \Drupal\lightning_media\Plugin\EntityBrowser\Widget\EmbedCode::getForm()
Overrides EntityFormProxy::getForm
File
- src/
Plugin/ EntityBrowser/ Widget/ EmbedCode.php, line 21
Class
- EmbedCode
- An Entity Browser widget for creating media entities from embed codes.
Namespace
Drupal\lightning_media\Plugin\EntityBrowser\WidgetCode
public function getForm(array &$original_form, FormStateInterface $form_state, array $additional_widget_parameters) {
$form = parent::getForm($original_form, $form_state, $additional_widget_parameters);
$form['input'] = [
'#type' => 'textarea',
'#placeholder' => $this
->t('Enter a URL...'),
'#attributes' => [
'class' => [
'keyup-change',
],
],
'#ajax' => [
'event' => 'change',
'wrapper' => 'entity',
'method' => 'html',
'callback' => [
static::class,
'ajax',
],
],
];
// Allow the form to be rebuilt without using AJAX.
$form['update'] = [
'#type' => 'submit',
'#value' => $this
->t('Update'),
'#attributes' => [
'class' => [
'js-hide',
],
],
'#submit' => [
[
static::class,
'update',
],
],
];
return $form;
}