Upgraded imagemagick and manually altered pdf to image module to handle changes....
[yaffs-website] / web / modules / contrib / paragraphs / tests / modules / paragraphs_test / src / Plugin / paragraphs / Behavior / TestFieldsSelectionBehavior.php
1 <?php
2
3 namespace Drupal\paragraphs_test\Plugin\paragraphs\Behavior;
4 use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
5 use Drupal\Core\Form\FormStateInterface;
6 use Drupal\paragraphs\Entity\Paragraph;
7 use Drupal\paragraphs\ParagraphsBehaviorBase;
8
9 /**
10  * Test plugin with field selection.
11  *
12  * @ParagraphsBehavior(
13  *   id = "test_field_selection",
14  *   label = @Translation("Test field selection for behavior plugin"),
15  *   description = @Translation("Test field selection for behavior plugin"),
16  *   weight = 0
17  * )
18  */
19 class TestFieldsSelectionBehavior extends ParagraphsBehaviorBase {
20
21   /**
22    * {@inheritdoc}
23    */
24   public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
25     $form['field_selection_filter'] = [
26       '#type' => 'select',
27       '#options' => $this->getFieldNameOptions($form_state->getFormObject()->getEntity(), 'image'),
28       '#title' => $this->t('Paragraph fields'),
29       '#default_value' => $this->configuration['field_selection_filter'],
30       '#description' => $this->t("Choose filtered paragraph field to be applied."),
31     ];
32
33     $form['field_selection'] = [
34       '#type' => 'select',
35       '#options' => $this->getFieldNameOptions($form_state->getFormObject()->getEntity()),
36       '#title' => $this->t('Paragraph fields'),
37       '#default_value' => $this->configuration['field_selection'],
38       '#description' => $this->t("Choose paragraph field to be applied."),
39     ];
40     return $form;
41   }
42
43   /**
44    * {@inheritdoc}
45    */
46   public function defaultConfiguration() {
47     return [
48       'field_selection' => '',
49       'field_selection_filter' => '',
50     ];
51   }
52
53   /**
54    * {@inheritdoc}
55    */
56   public function view(array &$build, Paragraph $paragraphs_entity, EntityViewDisplayInterface $display, $view_mode) {}
57
58 }