You are here

public static function ParagraphsWidget::getSets in Paragraphs Sets 8

Get the list of all defined sets.

Return value

array List of sets keyed by set ID.

6 calls to ParagraphsWidget::getSets()
ParagraphsWidget::buildModalAddForm in src/Plugin/Field/FieldWidget/ParagraphsWidget.php
Builds an add paragraph button for opening of modal form.
ParagraphsWidget::buildSelectSetSelection in src/Plugin/Field/FieldWidget/ParagraphsWidget.php
Builds select element for set selection.
ParagraphsWidget::formMultipleElements in src/Plugin/Field/FieldWidget/ParagraphsWidget.php
Special handling to create form elements for multiple values.
ParagraphsWidget::getDefaultParagraphTypeLabelName in src/Plugin/Field/FieldWidget/ParagraphsWidget.php
Returns the default paragraph type.
ParagraphsWidget::getDefaultParagraphTypeMachineName in src/Plugin/Field/FieldWidget/ParagraphsWidget.php
Returns the machine name for default paragraph set.

... See full list

File

src/Plugin/Field/FieldWidget/ParagraphsWidget.php, line 504

Class

ParagraphsWidget
Plugin implementation of 'entity_reference_revisions paragraphs sets' widget.

Namespace

Drupal\paragraphs_sets\Plugin\Field\FieldWidget

Code

public static function getSets() {
  $query = \Drupal::entityQuery('paragraphs_set');
  $config_factory = \Drupal::configFactory();
  $results = $query
    ->execute();
  $sets = [];
  foreach ($results as $id) {

    /** @var \Drupal\Core\Config\ImmutableConfig $config */
    if ($config = $config_factory
      ->get("paragraphs_sets.set.{$id}")) {
      $sets[$id] = $config
        ->getRawData();
    }
  }
  return $sets;
}