New feature: Allow module developers and site builders to define the text displayed instead of '- None -' or '- Select a value -'

I have attached a patch. To make the code a bit shorter by using the ?? operator, I also set the minimum PHP requirement to PHP 7.0.

Feedback to the patch content and the feature are welcome. I suggest commiting it in three separate commits:

  1. Add composer.json
  2. Source code formatting: use statements alphabetically
  3. New feature

Comments

Gogowitsch created an issue. See original summary.

el1_1el’s picture

Status: Active » Needs review
gogowitsch’s picture

The code from the patch has been in production for 4 months now, without any issues.

  • el1_1el committed d319db1 on 8.x-1.x
    Issue #3023842 by Gogowitsch, el1_1el: Empty option: add setting to...
el1_1el’s picture

Status: Needs review » Fixed

I added this with a setting in the UI so its easier to change. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

hoanns’s picture

Where is that GUI or how would I set it programmatically for a field?

Couldn't find anything, I'm just gonna use gogowitschs basefield solution with the following patch

el1_1el’s picture

Version: 8.x-1.x-dev » 8.x-1.4
StatusFileSize
new28.81 KB

yeah the dev branch of this module was screwed up due to a bad tag. ive removed that tag and it seems composer gets the dev package at head now, although it's coming in at 1.4 from the dev release page which i've removed. The empty text should be available in the widget settings.
photo of ui