You are here

public function EntityReferenceBrowserTableWidget::getAdditionalFieldsColumn in Entity Browser - Table Layout 8

Throws

\Drupal\Component\Plugin\Exception\PluginException

1 call to EntityReferenceBrowserTableWidget::getAdditionalFieldsColumn()
EntityReferenceBrowserTableWidget::buildTableRows in src/Plugin/Field/FieldWidget/EntityReferenceBrowserTableWidget.php

File

src/Plugin/Field/FieldWidget/EntityReferenceBrowserTableWidget.php, line 348

Class

EntityReferenceBrowserTableWidget
Plugin implementation of the 'entity_reference_browser_table_widget' widget.

Namespace

Drupal\entity_browser_table\Plugin\Field\FieldWidget

Code

public function getAdditionalFieldsColumn(EntityInterface $entity) {
  if (isset($this
    ->getAdditionalFields()['status']) === FALSE) {
    return NULL;
  }
  $status = $this->moderationInfo && $this->moderationInfo
    ->isModeratedEntity($entity) ? $entity
    ->get('moderation_state')->value : ($entity
    ->get('status')->value === '0' ? 'Unpublished' : 'Published');
  return [
    '#markup' => '<span class="moderation-status">' . $this
      ->t(':status', [
      ':status' => $status,
    ]) . '</span>',
  ];
}