dateFormatter = $date_formatter; } /** * {@inheritdoc} */ public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static( $entity_type, $container->get('entity.manager')->getStorage($entity_type->id()), $container->get('date.formatter') ); } /** * {@inheritdoc} */ public function buildHeader() { $header['id'] = t('Machine name'); $header['label'] = t('Name'); $header['pattern'] = t('Pattern'); return $header + parent::buildHeader(); } /** * {@inheritdoc} */ public function buildRow(EntityInterface $entity) { if ($entity->isLocked()) { $row['id'] = $this->t('@entity_id (locked)', array('@entity_id' => $entity->id())); } else { $row['id'] = $entity->id(); } $row['label'] = $this->getLabel($entity); $row['pattern'] = $this->dateFormatter->format(REQUEST_TIME, $entity->id()); return $row + parent::buildRow($entity); } }