You are here

function pcr_element_info_alter in Pretty Checkbox Radio 8

Implements hook_element_info_alter().

File

./pcr.module, line 43
This module allows convert default checkbox and radiobutton.

Code

function pcr_element_info_alter(array &$types) {

  // The elements to be processed to turn them into a pretty element.
  $candidate_elements = [
    'checkboxes',
    'radios',
    'checkbox',
    'radio',
  ];

  // Add a process function to each candidate element to modify it.
  foreach ($candidate_elements as $element) {
    if (isset($types[$element])) {
      $types[$element]['#process'][] = [
        'Drupal\\pcr\\PrettyElement',
        'process',
      ];
    }
  }
}