If the field type is Entity reference, choices of widget are shown in the picture. Is there any way to remove some choices from the widget list?
protected function getApplicablePluginOptions(FieldDefinitionInterface $ field_definition) { $ options = $ this->pluginManager->getOptions($ field_definition->getType()); $ applicable_options = []; foreach ($ options as $ option => $ label) { $ plugin_class = DefaultFactory::getPluginClass($ option, $ this->pluginManager->getDefinition($ option)); if ($ plugin_class::isApplicable($ field_definition)) { $ applicable_options[$ option] = $ label; } } return $ applicable_options; }
Choices are called $ options
in this function which is defined in the core/modules/field_ui
.