You are here

public function SalesforceAuthListBuilder::buildRow in Salesforce Suite 5.0.x

Same name and namespace in other branches
  1. 8.4 src/Controller/SalesforceAuthListBuilder.php \Drupal\salesforce\Controller\SalesforceAuthListBuilder::buildRow()

Builds a row for an entity in the entity listing.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity for this row of the list.

Return value

array A render array structure of fields for this entity.

Overrides EntityListBuilder::buildRow

See also

\Drupal\Core\Entity\EntityListBuilder::render()

File

src/Controller/SalesforceAuthListBuilder.php, line 17

Class

SalesforceAuthListBuilder
List builder for salesforce_auth.

Namespace

Drupal\salesforce\Controller

Code

public function buildRow(EntityInterface $entity) {

  /** @var \Drupal\salesforce\SalesforceAuthProviderInterface $plugin */
  $plugin = $entity
    ->getPlugin();
  $row['default'] = $entity
    ->authManager()
    ->getConfig() && $entity
    ->authManager()
    ->getConfig()
    ->id() == $entity
    ->id() ? $this
    ->t('Default') : '';
  $row['label'] = $entity
    ->label();
  $row['url'] = $plugin
    ->getCredentials()
    ->getLoginUrl();
  $row['key'] = substr($plugin
    ->getCredentials()
    ->getConsumerKey(), 0, 16) . '...';
  $row['type'] = $plugin
    ->label();
  $row['status'] = $plugin
    ->hasAccessToken() ? 'Authorized' : 'Missing';
  return $row + parent::buildRow($entity);
}