You are here

public static function CropType::getCropTypeNames in Crop API 8

Same name and namespace in other branches
  1. 8.2 src/Entity/CropType.php \Drupal\crop\Entity\CropType::getCropTypeNames()

Returns a list of available crop type names.

This list can include types that are queued for addition or deletion.

Return value

string[] An array of crop type labels, keyed by the crop type name.

Overrides CropTypeInterface::getCropTypeNames

File

src/Entity/CropType.php, line 130

Class

CropType
Defines the Crop type configuration entity.

Namespace

Drupal\crop\Entity

Code

public static function getCropTypeNames() {
  return array_map(function ($bundle_info) {
    return $bundle_info['label'];
  }, \Drupal::service('entity_type.bundle.info')
    ->getBundleInfo('crop'));
}