Как перекрыть функцию в субтеме?

Главные вкладки

Аватар пользователя VasyOK VasyOK 31 января 2024 в 18:42

Допустим в теме (на основании которой сделана субтема) есть функция.

function olivero_preprocess_field(&$variables) {
  $rich_field_types = ['text_with_summary', 'text', 'text_long'];

  if (in_array($variables['field_type'], $rich_field_types, TRUE)) {
    $variables['attributes']['class'][] = 'text-content';
  }

  if ($variables['field_type'] == 'image' && $variables['element']['#view_mode'] == 'full' && !$variables["element"]["#is_multiple"] && $variables['field_name'] !== 'user_picture') {
    $variables['attributes']['class'][] = 'wide-content';
  }
}

Мне она не нужна.
В файле mytheme.theme прописываю:

<?php

function olivero_preprocess_field(&$variables) {
}

function mytheme_preprocess_field(&$variables) {
}

и...ничего. А как правильно?

Комментарии