WSServerListBuilder.php in Web Service Data 2.0.x
File
src/WSServerListBuilder.php
View source
<?php
namespace Drupal\wsdata;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;
class WSServerListBuilder extends ConfigEntityListBuilder {
public function buildHeader() {
$header['label'] = $this
->t('Web Service Server');
$header['id'] = $this
->t('Machine name');
$header['type'] = $this
->t('Connector');
return $header + parent::buildHeader();
}
public function buildRow(EntityInterface $entity) {
$connectors = \Drupal::service('plugin.manager.wsconnector');
$connector_definitions = $connectors
->getDefinitions();
$connector = $connector_definitions[$entity->wsconnector];
$row['label'] = $entity
->label();
$row['id'] = $entity
->id();
$row['type'] = $connector['label']
->render();
return $row + parent::buildRow($entity);
}
}