|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace Drupal\list_predefined_options\Plugin\ListOptions; |
| 4 | + |
| 5 | +use Drupal\list_predefined_options\Plugin\ListOptionsBase; |
| 6 | +use Drupal\Core\Entity\FieldableEntityInterface; |
| 7 | +use Drupal\Core\Field\FieldStorageDefinitionInterface; |
| 8 | + |
| 9 | +/** |
| 10 | + * @ListOptions( |
| 11 | + * id = "us_states", |
| 12 | + * label = @Translation("US States"), |
| 13 | + * ) |
| 14 | + */ |
| 15 | +class USStates extends ListOptionsBase { |
| 16 | + |
| 17 | + /** |
| 18 | + * {@inheritdoc} |
| 19 | + */ |
| 20 | + public function getListOptions(FieldStorageDefinitionInterface $definition, FieldableEntityInterface $entity = NULL, &$cacheable = TRUE) { |
| 21 | + $options['AL'] = t('Alabama'); |
| 22 | + $options['AK'] = t('Alaska'); |
| 23 | + $options['AZ'] = t('Arizona'); |
| 24 | + $options['AR'] = t('Arkansas'); |
| 25 | + $options['CA'] = t('California'); |
| 26 | + $options['CO'] = t('Colorado'); |
| 27 | + $options['CT'] = t('Connecticut'); |
| 28 | + $options['DE'] = t('Delaware'); |
| 29 | + $options['DC'] = t('District Of Columbia'); |
| 30 | + $options['FL'] = t('Florida'); |
| 31 | + $options['GA'] = t('Georgia'); |
| 32 | + $options['HI'] = t('Hawaii'); |
| 33 | + $options['ID'] = t('Idaho'); |
| 34 | + $options['IL'] = t('Illinois'); |
| 35 | + $options['IN'] = t('Indiana'); |
| 36 | + $options['IA'] = t('Iowa'); |
| 37 | + $options['KS'] = t('Kansas'); |
| 38 | + $options['KY'] = t('Kentucky'); |
| 39 | + $options['LA'] = t('Louisiana'); |
| 40 | + $options['ME'] = t('Maine'); |
| 41 | + $options['MD'] = t('Maryland'); |
| 42 | + $options['MA'] = t('Massachusetts'); |
| 43 | + $options['MI'] = t('Michigan'); |
| 44 | + $options['MN'] = t('Minnesota'); |
| 45 | + $options['MS'] = t('Mississippi'); |
| 46 | + $options['MO'] = t('Missouri'); |
| 47 | + $options['MT'] = t('Montana'); |
| 48 | + $options['NE'] = t('Nebraska'); |
| 49 | + $options['NV'] = t('Nevada'); |
| 50 | + $options['NH'] = t('New Hampshire'); |
| 51 | + $options['NJ'] = t('New Jersey'); |
| 52 | + $options['NM'] = t('New Mexico'); |
| 53 | + $options['NY'] = t('New York'); |
| 54 | + $options['NC'] = t('North Carolina'); |
| 55 | + $options['ND'] = t('North Dakota'); |
| 56 | + $options['OH'] = t('Ohio'); |
| 57 | + $options['OK'] = t('Oklahoma'); |
| 58 | + $options['OR'] = t('Oregon'); |
| 59 | + $options['PA'] = t('Pennsylvania'); |
| 60 | + $options['RI'] = t('Rhode Island'); |
| 61 | + $options['SC'] = t('South Carolina'); |
| 62 | + $options['SD'] = t('South Dakota'); |
| 63 | + $options['TN'] = t('Tennessee'); |
| 64 | + $options['TX'] = t('Texas'); |
| 65 | + $options['UT'] = t('Utah'); |
| 66 | + $options['VT'] = t('Vermont'); |
| 67 | + $options['VA'] = t('Virginia'); |
| 68 | + $options['WA'] = t('Washington'); |
| 69 | + $options['WV'] = t('West Virginia'); |
| 70 | + $options['WI'] = t('Wisconsin'); |
| 71 | + $options['WY'] = t('Wyoming'); |
| 72 | + return $options; |
| 73 | + } |
| 74 | + |
| 75 | +} |
0 commit comments