예제 #1
0
 /**
  * {@inheritdoc}
  */
 public function buildRow(EntityInterface $entity)
 {
     /* @var $entity \Drupal\commerce_order\Entity\Order */
     $orderType = OrderType::load($entity->bundle());
     $row = ['order_id' => $entity->id(), 'type' => $orderType->label(), 'customer' => ['data' => ['#theme' => 'username', '#account' => $entity->getOwner()]], 'state' => $entity->getState()->getLabel(), 'created' => $this->dateFormatter->format($entity->getCreatedTime(), 'short')];
     return $row + parent::buildRow($entity);
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 public function buildRow(EntityInterface $entity)
 {
     $row['username']['data'] = array('#theme' => 'username', '#account' => $entity);
     $row['status'] = $entity->isActive() ? $this->t('active') : $this->t('blocked');
     $roles = array_map('\\Drupal\\Component\\Utility\\String::checkPlain', user_role_names(TRUE));
     unset($roles[DRUPAL_AUTHENTICATED_RID]);
     $users_roles = array();
     foreach ($entity->getRoles() as $role) {
         if (isset($roles[$role])) {
             $users_roles[] = $roles[$role];
         }
     }
     asort($users_roles);
     $row['roles']['data'] = array('#theme' => 'item_list', '#items' => $users_roles);
     $row['member_for'] = $this->dateFormatter->formatInterval(REQUEST_TIME - $entity->getCreatedTime());
     $row['access'] = $entity->access ? $this->t('@time ago', array('@time' => $this->dateFormatter->formatInterval(REQUEST_TIME - $entity->getLastAccessedTime()))) : t('never');
     return $row + parent::buildRow($entity);
 }
  /**
   * {@inheritdoc}
   */
  public function buildRow(EntityInterface $entity) {
    /* @var $entity \Drupal\commerce_payment\Entity\PaymentInfo */
    $paymentInfoType = PaymentInfoType::load($entity->bundle());

    $row = array(
      'information_id' => $entity->id(),
      'payment_method' => $paymentInfoType->label(),
      'owner' => array(
        'data' => array(
          '#theme' => 'username',
          '#account' => $entity->getOwner(),
        ),
      ),
      'status' => $entity->getStatus(),
      'created' => $this->dateFormatter->format($entity->getCreatedTime(), 'short'),
      'changed' => $this->dateFormatter->format($entity->getChangedTime(), 'short'),
    );
    return $row + parent::buildRow($entity);
  }
예제 #4
0
 /**
  * {@inheritdoc}
  */
 public function buildRow(EntityInterface $entity)
 {
     $row['username']['data'] = array('#theme' => 'username', '#account' => $entity);
     $row['status'] = $entity->isActive() ? $this->t('active') : $this->t('blocked');
     $roles = user_role_names(TRUE);
     unset($roles[RoleInterface::AUTHENTICATED_ID]);
     $users_roles = array();
     foreach ($entity->getRoles() as $role) {
         if (isset($roles[$role])) {
             $users_roles[] = $roles[$role];
         }
     }
     asort($users_roles);
     $row['roles']['data'] = array('#theme' => 'item_list', '#items' => $users_roles);
     $row['member_for'] = $this->dateFormatter->formatTimeDiffSince($entity->getCreatedTime());
     $row['access'] = $entity->access ? $this->t('@time ago', array('@time' => $this->dateFormatter->formatTimeDiffSince($entity->getLastAccessedTime()))) : t('never');
     return $row + parent::buildRow($entity);
 }
예제 #5
0
 /**
  * {@inheritdoc}
  */
 public function buildRow(EntityInterface $entity)
 {
     $row['username']['data'] = array('#theme' => 'username', '#account' => $entity);
     $row['status'] = $entity->isActive() ? $this->t('active') : $this->t('blocked');
     $roles = user_role_names(TRUE);
     unset($roles[RoleInterface::AUTHENTICATED_ID]);
     $users_roles = array();
     foreach ($entity->getRoles() as $role) {
         if (isset($roles[$role])) {
             $users_roles[] = $roles[$role];
         }
     }
     asort($users_roles);
     $row['roles']['data'] = array('#theme' => 'item_list', '#items' => $users_roles);
     $options = ['return_as_object' => TRUE];
     $row['member_for']['data'] = $this->dateFormatter->formatTimeDiffSince($entity->getCreatedTime(), $options)->toRenderable();
     $last_access = $this->dateFormatter->formatTimeDiffSince($entity->getLastAccessedTime(), $options);
     if ($entity->getLastAccessedTime()) {
         $row['access']['data']['#markup'] = $last_access->getString();
         CacheableMetadata::createFromObject($last_access)->applyTo($row['access']['data']);
     } else {
         $row['access']['data']['#markup'] = t('never');
     }
     return $row + parent::buildRow($entity);
 }