You are here

MiconContentTypeListBuilder.php in Micon 2.x

Same filename and directory in other branches
  1. 8 micon_content_type/src/MiconContentTypeListBuilder.php

File

micon_content_type/src/MiconContentTypeListBuilder.php
View source
<?php

namespace Drupal\micon_content_type;

use Drupal\Core\Entity\EntityInterface;
use Drupal\node\NodeTypeListBuilder;

/**
 * Provides a listing of ContentType.
 */
class MiconContentTypeListBuilder extends NodeTypeListBuilder {

  /**
   * {@inheritdoc}
   */
  public function buildHeader() {
    $header['icon'] = t('Icon');
    return $header + parent::buildHeader();
  }

  /**
   * {@inheritdoc}
   */
  public function buildRow(EntityInterface $entity) {
    $icon = micon_content_type_icon($entity);
    $row['icon']['data']['#markup'] = $icon ? micon()
      ->setIcon($icon) : '';
    return $row + parent::buildRow($entity);
  }

}

Classes

Namesort descending Description
MiconContentTypeListBuilder Provides a listing of ContentType.