You are here

protected function SubscriptionForm::fieldAsReadOnly in Commerce Recurring Framework 8

Builds a read-only form element for a field.

Parameters

string $label: The element label.

string $value: The element value.

Return value

array The form element.

1 call to SubscriptionForm::fieldAsReadOnly()
SubscriptionForm::form in src/Form/SubscriptionForm.php
Gets the actual form array to be built.

File

src/Form/SubscriptionForm.php, line 177

Class

SubscriptionForm

Namespace

Drupal\commerce_recurring\Form

Code

protected function fieldAsReadOnly($label, $value) {
  return [
    '#type' => 'item',
    '#wrapper_attributes' => [
      'class' => [
        Html::cleanCssIdentifier(strtolower($label)),
        'container-inline',
      ],
    ],
    '#markup' => '<h4 class="label inline">' . $label . '</h4> ' . $value,
  ];
}