public function PhoneNumberSettingsListBuilder::buildRow in SMS Framework 8
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/
Lists/ PhoneNumberSettingsListBuilder.php, line 92
Class
- PhoneNumberSettingsListBuilder
- Builds a list of phone number settings.
Namespace
Drupal\sms\ListsCode
public function buildRow(EntityInterface $entity) {
/** @var \Drupal\sms\Entity\PhoneNumberSettingsInterface $entity */
$entity_type_id = $entity
->getPhoneNumberEntityTypeId();
$bundle = $entity
->getPhoneNumberBundle();
$row['entity_type'] = $entity_type_id;
$row['bundle'] = $bundle;
$phone_number_settings = $this->phoneNumberVerificationProvider
->getPhoneNumberSettings($entity_type_id, $bundle);
$lifetime = $phone_number_settings
->getVerificationCodeLifetime() ?: 0;
$row['count_expired'] = $this
->buildPhoneNumberVerificationQuery($entity_type_id, $bundle)
->condition('status', 0)
->condition('created', $this->requestTime - $lifetime, '<')
->count()
->execute();
$row['count_verified'] = $this
->buildPhoneNumberVerificationQuery($entity_type_id, $bundle)
->condition('status', 1)
->count()
->execute();
$row['count_unverified'] = $this
->buildPhoneNumberVerificationQuery($entity_type_id, $bundle)
->condition('status', 0)
->count()
->execute();
$row['count_total'] = $this
->buildPhoneNumberVerificationQuery($entity_type_id, $bundle)
->count()
->execute();
return $row + parent::buildRow($entity);
}