You are here

public static function InlineParagraphsWidget::getSets in Paragraphs Sets 8

Get the list of all defined sets.

Return value

array List of sets keyed by set ID.

5 calls to InlineParagraphsWidget::getSets()
InlineParagraphsWidget::buildSelectSetSelection in src/Plugin/Field/FieldWidget/InlineParagraphsWidget.php
Builds select element for set selection.
InlineParagraphsWidget::formMultipleElements in src/Plugin/Field/FieldWidget/InlineParagraphsWidget.php
Special handling to create form elements for multiple values.
InlineParagraphsWidget::getDefaultParagraphTypeLabelName in src/Plugin/Field/FieldWidget/InlineParagraphsWidget.php
Returns the default paragraph type.
InlineParagraphsWidget::getDefaultParagraphTypeMachineName in src/Plugin/Field/FieldWidget/InlineParagraphsWidget.php
Returns the machine name for default paragraph set.
InlineParagraphsWidget::settingsForm in src/Plugin/Field/FieldWidget/InlineParagraphsWidget.php
Returns a form to configure settings for the widget.

File

src/Plugin/Field/FieldWidget/InlineParagraphsWidget.php, line 404

Class

InlineParagraphsWidget
Plugin definition of the 'entity_reference 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;
}