public function ShippingMethodListBuilder::buildRow in Commerce Shipping 8.2
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()
1 call to ShippingMethodListBuilder::buildRow()
- ShippingMethodListBuilder::buildForm in src/
ShippingMethodListBuilder.php - Form constructor.
File
- src/
ShippingMethodListBuilder.php, line 108
Class
- ShippingMethodListBuilder
- Defines the list builder for shipping methods.
Namespace
Drupal\commerce_shippingCode
public function buildRow(EntityInterface $entity) {
/** @var \Drupal\commerce_shipping\Entity\ShippingMethodInterface $entity */
if ($this->hasTableDrag) {
$row['#attributes']['class'][] = 'draggable';
}
$row['#weight'] = $entity
->getWeight();
$row['name'] = $entity
->label();
$row['status'] = $entity
->isEnabled() ? $this
->t('Enabled') : $this
->t('Disabled');
if ($this->hasTableDrag) {
$row['weight'] = [
'#type' => 'weight',
'#title' => $this
->t('Weight for @title', [
'@title' => $entity
->label(),
]),
'#title_display' => 'invisible',
'#default_value' => $entity
->getWeight(),
'#attributes' => [
'class' => [
'weight',
],
],
];
}
return $row + parent::buildRow($entity);
}