TestType.php in Media entity 8
File
tests/modules/media_entity_test_type/src/Plugin/MediaEntity/Type/TestType.php
View source
<?php
namespace Drupal\media_entity_test_type\Plugin\MediaEntity\Type;
use Drupal\Core\Form\FormStateInterface;
use Drupal\media_entity\Plugin\MediaEntity\Type\Generic;
class TestType extends Generic {
public function providedFields() {
return [
'field_1' => $this
->t('Field 1'),
'field_2' => $this
->t('Field 2'),
];
}
public function defaultConfiguration() {
return [
'test_config_value' => 'This is default value.',
];
}
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form['test_config_value'] = [
'#type' => 'textfield',
'#title' => $this
->t('Test config value'),
'#default_value' => empty($this->configuration['test_config_value']) ? NULL : $this->configuration['test_config_value'],
];
return $form;
}
}