You are here

protected function DefaultParagraphsWidget::getDefaultParagraphTypes in Default Paragraphs 8

Get the machine names of the default paragraph types.

1 call to DefaultParagraphsWidget::getDefaultParagraphTypes()
DefaultParagraphsWidget::formMultipleElements in src/Plugin/Field/FieldWidget/DefaultParagraphsWidget.php
Special handling to create form elements for multiple values.

File

src/Plugin/Field/FieldWidget/DefaultParagraphsWidget.php, line 513

Class

DefaultParagraphsWidget
Plugin implementation of the 'entity_reference_revisions paragraphs' widget.

Namespace

Drupal\default_paragraphs\Plugin\Field\FieldWidget

Code

protected function getDefaultParagraphTypes() {
  $defaults = [];
  $delta = 0;
  $count = 0;
  foreach ($this
    ->getSetting('default_paragraph_types') as $machine_name => $data) {
    if (!empty($data['value'])) {
      $defaults[$delta]['name'] = $machine_name;
      $defaults[$delta]['edit_mode'] = !empty($data['edit_mode']) ? $data['edit_mode'] : 'closed';
      $delta++;
    }
    $count++;
  }
  return $defaults;
}