Commit 30fdc739 authored by Heine Deelstra's avatar Heine Deelstra Committed by Erik Stielstra
Browse files

Issue #3228773 by Heine: Core template overrides not working on a subtheme...

Issue #3228773 by Heine: Core template overrides not working on a subtheme implementing the corresponding process hook
parent 5ff971a4
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -53,12 +53,12 @@ function a11y_form_helpers_form_alter(&$form, FormStateInterface $form_state, $f
 */
function a11y_form_helpers_theme_registry_alter(&$theme_registry) {
  // Replace default theme form-element.html.twig template from core.
  if (strpos($theme_registry['form_element']['theme path'], 'core/') === 0) {
    $path = array_reverse(explode('/', $theme_registry['form_element']['theme path']));
  if (strpos($theme_registry['form_element']['path'], 'core/') === 0) {
    $path = explode('/', $theme_registry['form_element']['path']);
    $module_path = drupal_get_path('module', 'a11y_form_helpers');

    if (file_exists($module_path . '/templates/' . $path[0])) {
      $theme_registry['form_element']['path'] = $module_path . '/templates/' . $path[0];
    if (file_exists($module_path . '/templates/' . $path[2])) {
      $theme_registry['form_element']['path'] = $module_path . '/templates/' . $path[2];
    }
    else {
      $theme_registry['form_element']['path'] = $module_path . '/templates/system';
@@ -68,12 +68,12 @@ function a11y_form_helpers_theme_registry_alter(&$theme_registry) {
  }

  // Replace default theme fieldset.html.twig template from core.
  if (strpos($theme_registry['fieldset']['theme path'], 'core/') === 0) {
    $path = array_reverse(explode('/', $theme_registry['fieldset']['theme path']));
  if (strpos($theme_registry['fieldset']['path'], 'core/') === 0) {
    $path = explode('/', $theme_registry['fieldset']['path']);
    $module_path = drupal_get_path('module', 'a11y_form_helpers');

    if (file_exists($module_path . '/templates/' . $path[0])) {
      $theme_registry['fieldset']['path'] = $module_path . '/templates/' . $path[0];
    if (file_exists($module_path . '/templates/' . $path[2])) {
      $theme_registry['fieldset']['path'] = $module_path . '/templates/' . $path[2];
    }
    else {
      $theme_registry['fieldset']['path'] = $module_path . '/templates/system';