You are here

StyleguidePatternListBuilder.php in Simple Style Guide 8

File

src/StyleguidePatternListBuilder.php
View source
<?php

namespace Drupal\simple_styleguide;

use Drupal\Core\Config\Entity\DraggableListBuilder;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Form\FormStateInterface;

/**
 * Defines a class to build a listing of user ball entities.
 *
 * @see \Drupal\simple_styleguide\Entity\StyleguidePattern
 */
class StyleguidePatternListBuilder extends DraggableListBuilder {

  /**
   * {@inheritdoc}
   */
  public function getFormId() {
    return 'sample_config_entity_ball_form';
  }

  /**
   * {@inheritdoc}
   */
  public function buildHeader() {
    $header['label'] = $this
      ->t('Name');
    return $header + parent::buildHeader();
  }

  /**
   * {@inheritdoc}
   */
  public function buildRow(EntityInterface $entity) {
    $row['label'] = $entity
      ->label();
    return $row + parent::buildRow($entity);
  }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    parent::submitForm($form, $form_state);
    $this
      ->messenger()
      ->addMessage('Styleguide pattern settings updated.');
  }

}

Classes

Namesort descending Description
StyleguidePatternListBuilder Defines a class to build a listing of user ball entities.