VideoTextfield.php in Video Embed Field 8.2
File
src/Plugin/Field/FieldWidget/VideoTextfield.php
View source
<?php
namespace Drupal\video_embed_field\Plugin\Field\FieldWidget;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\WidgetBase;
use Drupal\Core\Form\FormStateInterface;
class VideoTextfield extends WidgetBase {
public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
$element['value'] = $element + [
'#type' => 'textfield',
'#default_value' => isset($items[$delta]->value) ? $items[$delta]->value : NULL,
'#size' => 60,
'#maxlength' => $this
->getFieldSetting('max_length'),
'#attributes' => [
'class' => [
'js-text-full',
'text-full',
],
],
'#allowed_providers' => $this
->getFieldSetting('allowed_providers'),
'#theme' => 'input__video',
];
return $element;
}
}