HEX
Server: Apache/2.4.34 (Red Hat) OpenSSL/1.0.2k-fips
System: Linux WORDPRESS 3.10.0-1160.118.1.el7.x86_64 #1 SMP Thu Apr 4 03:33:23 EDT 2024 x86_64
User: digital (1020)
PHP: 7.2.24
Disabled: NONE
Upload Files
File: /datos/www/fabricas.colombiatrade.com.co/web_https/core/themes/classy/classy.theme
<?php

/**
 * @file
 * Functions to support theming in the Classy theme.
 */

use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Form\ViewsForm;

/**
 * Implements hook_preprocess_links__media_library_menu().
 *
 * This targets the menu of available media types in the media library's modal
 * dialog.
 *
 * @todo Do this in the relevant template once
 *   https://www.drupal.org/project/drupal/issues/3088856 is resolved.
 */
function classy_preprocess_links__media_library_menu(array &$variables) {
  foreach ($variables['links'] as &$link) {
    $link['link']['#options']['attributes']['class'][] = 'media-library-menu__link';
  }
}

/**
 * Implements hook_form_alter().
 */
function classy_form_alter(array &$form, FormStateInterface $form_state, $form_id) {
  $form_object = $form_state->getFormObject();
  if ($form_object instanceof ViewsForm && strpos($form_object->getBaseFormId(), 'views_form_media_library') === 0) {
    $form['#attributes']['class'][] = 'media-library-views-form';
  }
}

/**
 * Implements hook_preprocess_image_widget().
 */
function classy_preprocess_image_widget(array &$variables) {
  $data = &$variables['data'];
  if (isset($data['preview']['#access']) && $data['preview']['#access'] === FALSE) {
    unset($data['preview']);
  }
}