ExampleMarkup.php in Extra Field 8.2
File
modules/extra_field_example/src/Plugin/ExtraField/Form/ExampleMarkup.php
View source
<?php
namespace Drupal\extra_field_example\Plugin\ExtraField\Form;
use Drupal\Core\Form\FormStateInterface;
use Drupal\extra_field\Plugin\ExtraFieldFormBase;
class ExampleMarkup extends ExtraFieldFormBase {
public function formElement(array &$form, FormStateInterface $form_state) {
$element['markup'] = [
'#markup' => '<p>Hello world 1</p>',
];
$element['container'] = [
'#type' => 'container',
'#markup' => '<p>Hello world 2</p>',
];
$element['item'] = [
'#type' => 'item',
'#title' => 'Greeting',
'#markup' => '<p>Hello world 3</p>',
'#description' => "A common line of example output.",
];
return $element;
}
}