3 namespace Drupal\inline_entity_form_test;
5 use Drupal\Core\Form\FormBase;
6 use Drupal\Core\Form\FormStateInterface;
9 * Tests Inline entity form element.
11 class IefTest extends FormBase {
16 public function getFormID() {
23 public function buildForm(array $form, FormStateInterface $form_state, $form_mode = 'default') {
24 $form['inline_entity_form'] = [
25 '#type' => 'inline_entity_form',
26 '#entity_type' => 'node',
27 '#bundle' => 'ief_test_custom',
28 '#form_mode' => $form_mode,
32 '#value' => t('Save'),
40 public function submitForm(array &$form, FormStateInterface $form_state) {
41 $entity = $form['inline_entity_form']['#entity'];
42 drupal_set_message(t('Created @entity_type @label.', ['@entity_type' => $entity->getEntityType()->getLabel(), '@label' => $entity->label()]));