本文整理匯總了PHP中Drupal\Core\Entity\EntityInterface::getCreatedTime方法的典型用法代碼示例。如果您正苦於以下問題:PHP EntityInterface::getCreatedTime方法的具體用法?PHP EntityInterface::getCreatedTime怎麽用?PHP EntityInterface::getCreatedTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Drupal\Core\Entity\EntityInterface
的用法示例。
在下文中一共展示了EntityInterface::getCreatedTime方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: buildRow
/**
* {@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: buildRow
/**
* {@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);
}
示例3: buildRow
/**
* {@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: buildRow
/**
* {@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: buildRow
/**
* {@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);
}