commerce_checkout_accordion-1.0.x-dev/commerce_checkout_accordion.module
commerce_checkout_accordion.module
<?php
/**
* @file
* Functional features.
*/
use Drupal\Core\Form\FormStateInterface;
use Drupal\commerce_checkout_accordion\Form\CheckoutFlowAccordion;
/**
* Implements hook_form_alter().
*/
function commerce_checkout_accordion_form_alter(&$form, FormStateInterface $form_state, $form_id) {
\Drupal::service('class_resolver')->getInstanceFromDefinition(CheckoutFlowAccordion::class)->formAlter($form, $form_state, $form_id);
}
/**
* Implements hook_theme_registry_alter().
*
* Override the details.html.twig template.
*/
function commerce_checkout_accordion_theme_registry_alter(&$theme_registry) {
$theme_registry['details']['path'] = \Drupal::service('extension.list.module')->getPath('commerce_checkout_accordion') . '/templates';
}
/**
* Implements hook_preprocess_HOOK().
*/
function commerce_checkout_accordion_preprocess_details(&$variables) {
// Add the "Edit" link render array as a variable for the template.
if (!empty($variables['element']['edit'])) {
$variables['edit_element'] = $variables['element']['edit'];
// @todo Remove the Edit button from the <details> content.
}
// Add the pane summary render array as a variable for the template.
if (!empty($variables['element']['summary'])) {
$variables['summary_element'] = $variables['element']['summary'];
// @todo Remove the summary from the <details> content.
}
}
