Upgraded imagemagick and manually altered pdf to image module to handle changes....
[yaffs-website] / web / modules / contrib / inline_entity_form / tests / modules / inline_entity_form_test / src / IefEditTest.php
1 <?php
2
3 namespace Drupal\inline_entity_form_test;
4
5 use Drupal\Core\Form\FormBase;
6 use Drupal\Core\Form\FormStateInterface;
7 use Drupal\node\Entity\Node;
8
9 /**
10  * Tests Inline entity form element.
11  */
12 class IefEditTest extends FormBase {
13
14   /**
15    * {@inheritdoc}
16    */
17   public function getFormID() {
18     return 'ief_edit_test';
19   }
20
21   /**
22    * {@inheritdoc}
23    */
24   public function buildForm(array $form, FormStateInterface $form_state, Node $node = NULL, $form_mode = 'default') {
25     $form['inline_entity_form'] = [
26       '#type' => 'inline_entity_form',
27       '#entity_type' => 'node',
28       '#bundle' => 'ief_test_custom',
29       '#default_value' => $node,
30       '#form_mode' => $form_mode,
31     ];
32     $form['submit'] = [
33       '#type' => 'submit',
34       '#value' => t('Update'),
35     ];
36     return $form;
37   }
38
39   /**
40    * {@inheritdoc}
41    */
42   public function submitForm(array &$form, FormStateInterface $form_state) {
43     $entity = $form['inline_entity_form']['#entity'];
44     drupal_set_message(t('Created @entity_type @label.', ['@entity_type' => $entity->getEntityType()->getLabel(), '@label' => $entity->label()]));
45   }
46
47 }