webex_client-1.0.5/src/WebexListBuilder.php

src/WebexListBuilder.php
<?php

declare(strict_types=1);

namespace Drupal\webex_client;

use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;

/**
 * Provides a listing of webex entities.
 */
final class WebexListBuilder extends ConfigEntityListBuilder {

  /**
   * {@inheritdoc}
   */
  public function buildHeader(): array {
    $header['label'] = $this->t('Label');
    $header['id'] = $this->t('Machine name');
    $header['default'] = $this->t('By Default');
    $header['status'] = $this->t('Status');
    return $header + parent::buildHeader();
  }

  /**
   * {@inheritdoc}
   */
  public function buildRow(EntityInterface $entity): array {
    /** @var \Drupal\webex_client\WebexInterface $entity */
    $row['label'] = $entity->label();
    $row['id'] = $entity->id();
    $row['default'] = $entity->isDefault() ? $this->t('Predetermined') : '';
    $row['status'] = $entity->status() ? $this->t('Connected') : $this->t('Disconnected');
    return $row + parent::buildRow($entity);
  }

  /**
   * {@inheritdoc}
   */
  public function getDefaultOperations(EntityInterface $entity): array {
    $operations = parent::getDefaultOperations($entity);

    $operations['is_default'] = [
      'title' => $this->t('Make default'),
      'url' => $entity->toUrl('make_default'),
      'weight' => 30,
    ];

    return $operations;
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc