array( 0 => 'Zero', ), 1 => 'One', 'Group 2' => array( 2 => 'Some & unescaped markup', ), ); return $values; } /** * An entity-bound allowed values callback. */ function options_test_dynamic_values_callback(FieldDefinitionInterface $field_definition, EntityInterface $entity, &$cacheable) { $cacheable = FALSE; $values = array( $entity->label(), $entity->url(), $entity->uuid(), $entity->bundle(), ); // We need the values of the entity as keys. return array_combine($values, $values); }