Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Problem/Motivation
public function getOptionsProvider($property_name, FieldableEntityInterface $entity) {
if (is_subclass_of($this->getFieldItemClass(), '\Drupal\Core\TypedData\OptionsProviderInterface')) {
$items = $entity->get($this->getName());
return \Drupal::service('plugin.manager.field.field_type')->createFieldItem($items, 0);
}
// @todo: Allow setting custom options provider, see
// https://www.drupal.org/node/2002138.
}
$property_name
is simply unused. We have a @todo but that's against a "closed (fixed)" issue.
Proposed resolution
Perhaps move the $property_name into getSettableOptions.
Remaining tasks
User interface changes
Likely none.
API changes
No idea.
Comments
Comment #1
chx CreditAttribution: chx commentedComment #2
dawehnerWell, to be clear, let's have a look at some code in
so nothing stops you from defining your own custom base field definition, which then would actually have a good usecase for
$property_name
Comment #11
quietone CreditAttribution: quietone as a volunteer commented