public function TaxRateListBuilder::buildRow in Ubercart 8.4
Same name in this branch
- 8.4 uc_tax/src/TaxRateListBuilder.php \Drupal\uc_tax\TaxRateListBuilder::buildRow()
- 8.4 uc_tax/src/Controller/TaxRateListBuilder.php \Drupal\uc_tax\Controller\TaxRateListBuilder::buildRow()
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
- uc_tax/
src/ Controller/ TaxRateListBuilder.php, line 31
Class
- TaxRateListBuilder
- Provides a listing of uc_tax_rate configuration entities.
Namespace
Drupal\uc_tax\ControllerCode
public function buildRow(EntityInterface $entity) {
$row['label'] = $entity
->getLabel();
$row['rate'] = (double) $entity
->getRate() * 100 . '%';
$row['shippable'] = $entity
->isForShippable() ? $this
->t('Shippable products') : $this
->t('Any product');
$row['product_types'] = implode(', ', $entity
->getProductTypes());
$row['line_item_types'] = implode(', ', $entity
->getLineItemTypes());
$row['weight'] = $entity
->getWeight();
// $row['weight'] = [
// '#type' => 'weight',
// '#default_value' => $entity->getWeight(),
// '#attributes' => ['class' => ['uc-tax-method-weight']],
// ];
//$row['weight']['#attributes'] = ['class' => ['uc-quote-method-weight']];
return $row + parent::buildRow($entity);
}