Hi. I am getting the following error when trying to edit a field. Any ideas how to fix this?
Structure -> Content Types -> Manage Fields -> Edit
Recently upgraded to Drupal 8.2.7 and Domain alpha8 (see attached for all installed modules and versions).
Warning: call_user_func() expects parameter 1 to be a valid callback, class 'Drupal\domain_access\DomainAccessManager' does not have a method 'getDefaultAllValue' in Drupal\Core\Field\FieldConfigBase->getDefaultValue() (line 388 of core\lib\Drupal\Core\Field\FieldConfigBase.php).
Drupal\Core\Field\FieldConfigBase->getDefaultValue(Object) (Line: 180)
Drupal\Core\Field\FieldItemList->applyDefaultValue() (Line: 112)
Drupal\Core\Entity\ContentEntityStorageBase->initFieldValues(Object, Array) (Line: 88)
Drupal\Core\Entity\ContentEntityStorageBase->doCreate(Array) (Line: 184)
Drupal\Core\Entity\EntityStorageBase->create(Array) (Line: 299)
_field_create_entity_from_ids(Object) (Line: 80)
Drupal\field_ui\Form\FieldConfigEditForm->form(Array, Object) (Line: 115)
Drupal\Core\Entity\EntityForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 514)
Drupal\Core\Form\FormBuilder->retrieveForm('field_config_edit_form', Object) (Line: 271)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 74)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 144)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 652)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Comments
Comment #2
znak commentedMaybe, this patch will fix your problems. Please, check up.
Comment #3
agentrickardWe deliberately removed the default value callback for the "All" field. The field handler definitions have to be changed and the getDefaultAllValue() method has been removed.
Make sure you run domain_alpha_update_8004(), which you might have to manually force if that module was not enabled before you updated.
This change was made to allow the field value to be configurable on a per-node type basis.
See https://github.com/agentrickard/domain/pull/335.
Comment #4
jtkunley commentedsee #5
Comment #5
jtkunley commentedApplied #2 patch and changed method name to 8005 to force the update. Update went through. Now the problem appears when adding a new node. Any ideas?
Issue
Update DB
---------------------------
New Code
Comment #6
agentrickardWell, that error would mean that the update didn't work, though I can't really replicate that in DEV.
You could remove the IF condition
if ($field->get('default_value_callback') === 'Drupal\domain_access\DomainAccessManager::getDefaultValue') {and run it again.Or use Config Synchronization to export the field, manually edit the YML and reload it.
The final YML should look like so. There will be one for each node type and for users:
Comment #7
jtkunley commentedOkay, I got it now.
My config for all content types looked like this before update, so 'if' statement never executed (as you've rightly guessed!)
So I kept the
ifstatement and just reverted to original version (check forgetDefaultAllValue). Afterdrush updbeverything looks good now. Thanks Ken!Comment #8
jtkunley commentedComment #9
jtkunley commentedComment #11
agentrickardComment #12
londova commentedIt seems this error still exists after updating to "alpha10" version.
Comment #13
tancAn old issue but I just wanted to note I came across this problem while doing a Drupal 9 upgrade on someone's site. All hook updates had been run, but looking at the exported config I could see that
default_value_callback: 'Drupal\domain_access\DomainAccessManager::getDefaultAllValue'still existed.I did a find and replace on the config/sync dir with the following:
From:
default_value_callback: 'Drupal\domain_access\DomainAccessManager::getDefaultAllValue'To:
default_value_callback: ''Then imported the config and confirmed that it fixed the error.
Comment #14
ron collins commentedThis just came up now for me on Drupal 10.3.0
The solution in #13 worked.