Welcome To Our Shell

Mister Spy & Souheyl Bypass Shell

Current Path : /var/www/html/rocksensor2/web/core/modules/options/tests/options_test/

Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
Upload File :
Current File : /var/www/html/rocksensor2/web/core/modules/options/tests/options_test/options_test.module

<?php

/**
 * @file
 * Helper module for the List module tests.
 */

use Drupal\Core\Entity\FieldableEntityInterface;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\Core\Form\FormStateInterface;

/**
 * Implements callback_allowed_values_function().
 *
 * @see options_allowed_values()
 */
function options_test_allowed_values_callback(FieldStorageDefinitionInterface $definition, ?FieldableEntityInterface $entity = NULL) {
  $values = [
    'Group 1' => [
      0 => 'Zero',
    ],
    1 => 'One',
    'Group 2' => [
      2 => 'Some <script>dangerous</script> & unescaped <strong>markup</strong>',
    ],
    'More <script>dangerous</script> markup' => [
      3 => 'Three',
    ],
  ];

  return $values;
}

/**
 * Implements callback_allowed_values_function().
 *
 * @todo This function violates the recommendation in options_allowed_values()
 *   to return a list of all possible values in any context when $items is
 *   NULL. Since this is not yet used for testing Views integration, that is
 *   alright for now. Fix this in https://www.drupal.org/node/2012130.
 *
 * @see options_allowed_values()
 */
function options_test_dynamic_values_callback(FieldStorageDefinitionInterface $definition, ?FieldableEntityInterface $entity = NULL, &$cacheable = NULL) {
  $values = [];
  if (isset($entity)) {
    $cacheable = FALSE;
    $values = [
      $entity->label(),
      $entity->toUrl()->toString(),
      $entity->uuid(),
      $entity->bundle(),
    ];
  }
  // We need the values of the entity as keys.
  return array_combine($values, $values);
}

/**
 * Implements hook_form_FORM_ID_alter().
 */
function options_test_form_entity_test_entity_test_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  if (\Drupal::state()->get('options_test.form_alter_enable', FALSE)) {
    $form['card_1']['widget']['#required_error'] = t('This is custom message for required field.');
  }
}

/**
 * Implements hook_options_list_alter().
 */
function options_test_options_list_alter(array &$options, array $context) {
  if ($context['fieldDefinition']->getName() === 'card_4' && $context['widget']->getPluginId() === 'options_select') {
    // Rename _none option.
    $options['_none'] = '- Select something -';
  }

  if ($context['fieldDefinition']->getName() === 'card_4' && $context['entity']->bundle() === 'entity_test') {
    // Remove 0 option.
    unset($options[0]);
  }
}

bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped)
Email: contact@elmoujehidin.net bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped) Email: contact@elmoujehidin.net