@drumm I can see why deleting/unpublishing an actively used project would be a bad idea. I think it's pretty clear @omahm is in a bit of a stuck state due to being unfamiliar with the module/composer admin process so this is more of a support request to yourself or another person who might be able to help. A new project was created to supersede the original module but it's unclear why the composer package name has the structure @omahm outlined in comment #5.
I guess we need a steer on how to turn drupal/published_state_indicator-published_state_indicator into drupal/published_state_indicator, if possible? Any help or directions much appreciated, thanks
For what it's worth, I found that I could work around this with something like:
$form['foo'] = [
'#type' => 'select',
'#required' => FALSE,
'#empty_value' => FALSE,
'#sort_options' => TRUE,
'#options' => [... list of key/value options ...],
];
combined with something like this in a form_alter hook:
$foo_value = \Drupal::request()->query->get('foo');
if (empty($foo_value) {
$form['foo']['#value'] = 'key_value_from_one_of_the_options',
}
Which essentially means if there's no query string value for the filter, it sets a default value.
Wouldn't it be a lot handier to just set a #default_value attribute on the render element and internalise any other complications around that to the Select render element class? I appreciate I might not fully understand the existing reasons so would be more than happy if someone who can explain it in more simple terms could do that and enlighten me.
I've been scratching my head about this for a while today. I have a views exposed form element as a select element, with about 10 options and should only take one value. I can use #value to pre-populate the initial value but this is then fixed and can't be changed by the user. If I try to use #default_value to indicate a starting value/pre-selection it's completely ignored on this element type.
I'm pretty sure I've used #default_value as an attribute in Drupal 7 and 8. The Select.php class docs state:
* - #default_value: Must be NULL or not set in case there is no value for the
* element yet, in which case a first default option is inserted by default.
* Whether this first option is a valid option depends on whether the field
* is #required or not.
If I try to adjust #empty_value the form tells me 'The submitted value is not allowed'.
Entirely probable that I'm applying the wrong combination of properties (somehow) but I'm confused how #default_value can't be applied on this element (string for single value, array for multiple values), when other elements accept this property in a consistent manner.
What can be done to clarify the appropriate way to use the Select element via the class docs, or is this a bug?
Re-rolled #11 to work against 2.3.x
@rcodina no problem, attached is an interdiff between #10 and #16. Thanks
Here's a patch which also changes the domain source field to have a 'field_' prefix, as nodes do.