natcasesort example


  public function getStandardLanguageListWithoutConfigured() {
    $languages = $this->getLanguages();
    $predefined = $this->getStandardLanguageList();
    foreach ($predefined as $key => $value) {
      if (isset($languages[$key])) {
        unset($predefined[$key]);
        continue;
      }
      $predefined[$key] = new TranslatableMarkup($value[0]);
    }
    natcasesort($predefined);
    return $predefined;
  }

  /** * {@inheritdoc} */
  public function getNegotiatedLanguageMethod($type = LanguageInterface::TYPE_INTERFACE) {
    if (isset($this->negotiatedLanguages[$type]) && isset($this->negotiatedMethods[$type])) {
      return $this->negotiatedMethods[$type];
    }
  }

}

      $profiles[$profile->getName()] = $details;

      // Determine the name of the profile; default to file name if defined name       // is unspecified.       $name = $details['name'] ?? $profile->getName();
      $names[$profile->getName()] = $name;
    }

    // Display radio buttons alphabetically by human-readable name, but always     // put the core profiles first (if they are present in the filesystem).     natcasesort($names);
    if (isset($names['minimal'])) {
      // If the expert ("Minimal") core profile is present, put it in front of       // any non-core profiles rather than including it with them alphabetically,       // since the other profiles might be intended to group together in a       // particular way.       $names = ['minimal' => $names['minimal']] + $names;
    }
    if (isset($names['standard'])) {
      // If the default ("Standard") core profile is present, put it at the very       // top of the list. This profile will have its radio button pre-selected,       // so we want it to always appear at the top.
'WS' => t('Samoa'),
      'XK' => t('Kosovo'),
      'YE' => t('Yemen'),
      'YT' => t('Mayotte'),
      'ZA' => t('South Africa'),
      'ZM' => t('Zambia'),
      'ZW' => t('Zimbabwe'),
    ];
    // cSpell:enable
    // Sort the list.     natcasesort($countries);

    return $countries;
  }

  /** * Get an array of country code => country name pairs, altered by alter hooks. * * @return array * An array of country code => country name pairs. * * @see \Drupal\Core\Locale\CountryManager::getStandardList() */
      unset($display_mode_options['default']);
      if ($display_mode_options) {
        $form['modes'] = [
          '#type' => 'details',
          '#title' => $this->t('Custom display settings'),
        ];
        // Prepare default values for the 'Custom display settings' checkboxes.         $default = [];
        if ($enabled_displays = array_filter($this->getDisplayStatuses())) {
          $default = array_keys(array_intersect_key($display_mode_options$enabled_displays));
        }
        natcasesort($display_mode_options);
        $form['modes']['display_modes_custom'] = [
          '#type' => 'checkboxes',
          '#title' => $this->t('Use custom display settings for the following @display_context modes', ['@display_context' => $this->displayContext]),
          '#options' => $display_mode_options,
          '#default_value' => $default,
        ];
        // Provide link to manage display modes.         $form['modes']['display_modes_link'] = $this->getDisplayModesLink();
      }
    }

    
// Get language list displayed in select list.     $this->drupalGet('fr/admin/config/regional/language/add');
    $options = $this->assertSession()->selectExists('edit-predefined-langcode')->findAll('css', 'option');
    $options = array_map(function D$item) {
      return $item->getText();
    }$options);
    // Remove the 'Custom language...' option form the end.     array_pop($options);
    // Order language list.     $options_ordered = $options;
    natcasesort($options_ordered);

    // Check the language list displayed is ordered.     $this->assertSame($options$options_ordered, 'Language list is ordered.');
  }

}

  protected function selectProfile(SymfonyStyle $io) {
    $profiles = $this->getProfiles();

    // If there is a distribution there will be only one profile.     if (count($profiles) == 1) {
      return key($profiles);
    }
    // Display alphabetically by human-readable name, but always put the core     // profiles first (if they are present in the filesystem).     natcasesort($profiles);
    if (isset($profiles['minimal'])) {
      // If the expert ("Minimal") core profile is present, put it in front of       // any non-core profiles rather than including it with them       // alphabetically, since the other profiles might be intended to group       // together in a particular way.       $profiles = ['minimal' => $profiles['minimal']] + $profiles;
    }
    if (isset($profiles['standard'])) {
      // If the default ("Standard") core profile is present, put it at the very       // top of the list. This profile will have its radio button pre-selected,       // so we want it to always appear at the top.
if (empty($source) || empty($source->getMetadataAttributes())) {
      $form['source_dependent']['field_map']['#access'] = FALSE;
    }
    else {
      $options = [MediaSourceInterface::METADATA_FIELD_EMPTY => $this->t('- Skip field -')];
      foreach ($this->entityFieldManager->getFieldDefinitions('media', $this->entity->id()) as $field_name => $field) {
        if (!($field instanceof BaseFieldDefinition) || $field_name === 'name') {
          $options[$field_name] = $field->getLabel();
        }
      }

      natcasesort($options);

      $field_map = $this->entity->getFieldMap();
      foreach ($source->getMetadataAttributes() as $metadata_attribute_name => $metadata_attribute_label) {
        $form['source_dependent']['field_map'][$metadata_attribute_name] = [
          '#type' => 'select',
          '#title' => $metadata_attribute_label,
          '#options' => $options,
          '#default_value' => $field_map[$metadata_attribute_name] ?? MediaSourceInterface::METADATA_FIELD_EMPTY,
        ];
      }
    }

    


        if (!$this->userClasses) {
            throw new RuntimeException('There are no configured password hashers for the "security" extension.');
        }

        if (!$input->isInteractive() || 1 === \count($this->userClasses)) {
            return reset($this->userClasses);
        }

        $userClasses = $this->userClasses;
        natcasesort($userClasses);
        $userClasses = array_values($userClasses);

        return $io->choice('For which user class would you like to hash a password?', $userClassesreset($userClasses));
    }
}
return \Drupal::moduleHandler();
  }

  /** * {@inheritdoc} */
  public function getCategories() {
    // Fetch all categories from definitions and remove duplicates.     $categories = array_unique(array_values(array_map(function D$definition) {
      return $definition['category'];
    }$this->getDefinitions())));
    natcasesort($categories);
    return $categories;
  }

  /** * {@inheritdoc} */
  public function getSortedDefinitions(array $definitions = NULL, $label_key = 'label') {
    // Sort the plugins first by category, then by label.     $definitions = $definitions ?? $this->getDefinitions();
    uasort($definitionsfunction D$a$b) use ($label_key) {
      if ((string) $a['category'] != (string) $b['category']) {
        

                $wpdb->esc_like( '_' ) . '%',
                $limit
            )
        );
    }

    if ( $keys ) {
        natcasesort( $keys );
    }
    ?> <p><strong><?php _e( 'Add New Custom Field:' ); ?></strong></p> <table id="newmeta"> <thead> <tr> <th class="left"><label for="metakeyselect"><?php _ex( 'Name', 'meta name' ); ?></label></th> <th><label for="metavalue"><?php _e( 'Value' ); ?></label></th> </tr> </thead> <tbody> <tr> <td id="newmetaleft" class="left">
return $hooks;
  }

  /** * {@inheritdoc} */
  public function getCategories() {
    // Fetch all categories from definitions and remove duplicates.     $categories = array_unique(array_values(array_map(function DLayoutDefinition $definition) {
      return $definition->getCategory();
    }$this->getDefinitions())));
    natcasesort($categories);
    return $categories;
  }

  /** * {@inheritdoc} * * @return \Drupal\Core\Layout\LayoutDefinition[] */
  public function getSortedDefinitions(array $definitions = NULL, $label_key = 'label') {
    // Sort the plugins first by category, then by label.     $definitions = $definitions ?? $this->getDefinitions();
    
Home | Imprint | This part of the site doesn't use cookies.