Thanks for your module, but that not work for me.
I encounter PHP error when I wnat to create new node or when I change order in form display of any node type.
then I have to disable this module.
I'm using wamp // errors :
1.
Drupal\Core\Entity\EntityStorageException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '37132bf5-dfe7-4fad-8931-d9e82b5e42fc' for key 'paragraph_field__uuid__value': INSERT INTO {paragraphs_item} (revision_id, type, uuid, langcode) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3); Array ( [:db_insert_placeholder_0] => [:db_insert_placeholder_1] => bp_simple [:db_insert_placeholder_2] => 37132bf5-dfe7-4fad-8931-d9e82b5e42fc [:db_insert_placeholder_3] => fa ) در Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (خط ۸۰۵ از C:\wamp64\www\d8testw\core\lib\Drupal\Core\Entity\Sql\SqlContentEntityStorage.php).
2.
Error: Call to a member function getValue() on null in paragraphs_clean_entity_presave() (line ۱۶ of C:\wamp64\www\d8testw\modules\paragraphs_clean\paragraphs_clean.module) #۰ [internal function]: paragraphs_clean_entity_presave(Object(Drupal\paragraph_blocks\Entity\ParagraphBlocksEntity)) #1 C:\wamp64\www\d8testw\core\lib\Drupal\Core\Extension\ModuleHandler.php(402): call_user_func_array('paragraphs_clea...', Array) #2 C:\wamp64\www\d8testw\core\lib\Drupal\Core\Entity\EntityStorageBase.php(169): Drupal\Core\Extension\ModuleHandler->invokeAll('entity_presave', Array) #3 C:\wamp64\www\d8testw\core\lib\Drupal\Core\Entity\ContentEntityStorageBase.php(435): Drupal\Core\Entity\EntityStorageBase->invokeHook('presave', Object(Drupal\paragraph_blocks\Entity\ParagraphBlocksEntity)) #4 C:\wamp64\www\d8testw\core\lib\Drupal\Core\Entity\EntityStorageBase.php(435): Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('presave', Object(Drupal\paragraph_blocks\Entity\ParagraphBlocksEntity)) #5 C:\wamp64\www\d8testw\core\lib\Drupal\Core\Entity\ContentEntityStorageBase.php(292): Drupal\Core\Entity\EntityStorageBase->doPreSave(Object(Drupal\paragraph_blocks\Entity\ParagraphBlocksEntity)) #6 C:\wamp64\www\d8testw\core\lib\Drupal\Core\Entity\EntityStorageBase.php(389): Drupal\Core\Entity\ContentEntityStorageBase->doPreSave(Object(Drupal\paragraph_blocks\Entity\ParagraphBlocksEntity)) #7 C:\wamp64\www\d8testw\core\lib\Drupal\Core\Entity\Sql\SqlContentEntityStorage.php(796): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\paragraph_blocks\Entity\ParagraphBlocksEntity)) #8 C:\wamp64\www\d8testw\core\lib\Drupal\Core\Entity\Entity.php(377): Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object(Drupal\paragraph_blocks\Entity\ParagraphBlocksEntity)) #9 C:\wamp64\www\d8testw\core\lib\Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem.php(259): Drupal\Core\Entity\Entity->save() #10 C:\wamp64\www\d8testw\modules\entity_reference_revisions\src\Plugin\Field\FieldType\EntityReferenceRevisionsItem.php(254): Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem->preSave() #11 C:\wamp64\www\d8testw\core\lib\Drupal\Core\Field\FieldItemList.php(245): Drupal\entity_reference_revisions\Plugin\Field\FieldType\EntityReferenceRevisionsItem->preSave() #12 C:\wamp64\www\d8testw\core\lib\Drupal\Core\Field\FieldItemList.php(203): Drupal\Core\Field\FieldItemList->delegateMethod('preSave') #13 C:\wamp64\www\d8testw\core\lib\Drupal\Core\Entity\ContentEntityStorageBase.php(473): Drupal\Core\Field\FieldItemList->preSave() #14 C:\wamp64\www\d8testw\core\lib\Drupal\Core\Entity\ContentEntityStorageBase.php(423): Drupal\Core\Entity\ContentEntityStorageBase->invokeFieldMethod('preSave', Object(Drupal\paragraph_blocks\Entity\ParagraphBlocksEntity)) #15 C:\wamp64\www\d8testw\core\lib\Drupal\Core\Entity\EntityStorageBase.php(435): Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('presave', Object(Drupal\paragraph_blocks\Entity\ParagraphBlocksEntity)) #16 C:\wamp64\www\d8testw\core\lib\Drupal\Core\Entity\ContentEntityStorageBase.php(292): Drupal\Core\Entity\EntityStorageBase->doPreSave(Object(Drupal\paragraph_blocks\Entity\ParagraphBlocksEntity)) #17 C:\wamp64\www\d8testw\core\lib\Drupal\Core\Entity\EntityStorageBase.php(389): Drupal\Core\Entity\ContentEntityStorageBase->doPreSave(Object(Drupal\paragraph_blocks\Entity\ParagraphBlocksEntity)) #18 C:\wamp64\www\d8testw\core\lib\Drupal\Core\Entity\Sql\SqlContentEntityStorage.php(796): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\paragraph_blocks\Entity\ParagraphBlocksEntity)) #19 C:\wamp64\www\d8testw\core\lib\Drupal\Core\Entity\Entity.php(377): Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object(Drupal\paragraph_blocks\Entity\ParagraphBlocksEntity)) #20 C:\wamp64\www\d8testw\core\lib\Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem.php(259): Drupal\Core\Entity\Entity->save() #21 C:\wamp64\www\d8testw\modules\entity_reference_revisions\src\Plugin\Field\FieldType\EntityReferenceRevisionsItem.php(254): Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem->preSave() #22 C:\wamp64\www\d8testw\core\lib\Drupal\Core\Field\FieldItemList.php(245): Drupal\entity_reference_revisions\Plugin\Field\FieldType\EntityReferenceRevisionsItem->preSave() #23 C:\wamp64\www\d8testw\core\lib\Drupal\Core\Field\FieldItemList.php(203): Drupal\Core\Field\FieldItemList->delegateMethod('preSave') #24 C:\wamp64\www\d8testw\core\lib\Drupal\Core\Entity\ContentEntityStorageBase.php(473): Drupal\Core\Field\FieldItemList->preSave() #25 C:\wamp64\www\d8testw\core\lib\Drupal\Core\Entity\ContentEntityStorageBase.php(423): Drupal\Core\Entity\ContentEntityStorageBase->invokeFieldMethod('preSave', Object(Drupal\node\Entity\Node)) #26 C:\wamp64\www\d8testw\core\lib\Drupal\Core\Entity\EntityStorageBase.php(435): Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('presave', Object(Drupal\node\Entity\Node)) #27 C:\wamp64\www\d8testw\core\lib\Drupal\Core\Entity\ContentEntityStorageBase.php(292): Drupal\Core\Entity\EntityStorageBase->doPreSave(Object(Drupal\node\Entity\Node)) #28 C:\wamp64\www\d8testw\core\lib\Drupal\Core\Entity\EntityStorageBase.php(389): Drupal\Core\Entity\ContentEntityStorageBase->doPreSave(Object(Drupal\node\Entity\Node)) #29 C:\wamp64\www\d8testw\core\lib\Drupal\Core\Entity\Sql\SqlContentEntityStorage.php(796): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\node\Entity\Node)) #30 C:\wamp64\www\d8testw\core\lib\Drupal\Core\Entity\Entity.php(377): Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object(Drupal\node\Entity\Node)) #31 C:\wamp64\www\d8testw\core\modules\node\src\NodeForm.php(286): Drupal\Core\Entity\Entity->save() #32 [internal function]: Drupal\node\NodeForm->save(Array, Object(Drupal\Core\Form\FormState)) #33 C:\wamp64\www\d8testw\core\lib\Drupal\Core\Form\FormSubmitter.php(111): call_user_func_array(Array, Array) #34 C:\wamp64\www\d8testw\core\lib\Drupal\Core\Form\FormSubmitter.php(51): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object(Drupal\Core\Form\FormState)) #35 C:\wamp64\www\d8testw\core\lib\Drupal\Core\Form\FormBuilder.php(585): Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object(Drupal\Core\Form\FormState)) #36 C:\wamp64\www\d8testw\core\lib\Drupal\Core\Form\FormBuilder.php(314): Drupal\Core\Form\FormBuilder->processForm('node_product_ct...', Array, Object(Drupal\Core\Form\FormState)) #37 C:\wamp64\www\d8testw\core\lib\Drupal\Core\Entity\EntityFormBuilder.php(48): Drupal\Core\Form\FormBuilder->buildForm('node_product_ct...', Object(Drupal\Core\Form\FormState)) #38 C:\wamp64\www\d8testw\core\modules\node\src\Controller\NodeController.php(113): Drupal\Core\Entity\EntityFormBuilder->getForm(Object(Drupal\node\Entity\Node)) #39 [internal function]: Drupal\node\Controller\NodeController->add(Object(Drupal\node\Entity\NodeType)) #40 C:\wamp64\www\d8testw\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #41 C:\wamp64\www\d8testw\core\lib\Drupal\Core\Render\Renderer.php(582): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #42 C:\wamp64\www\d8testw\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #43 C:\wamp64\www\d8testw\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #44 [internal function]: Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #45 C:\wamp64\www\d8testw\vendor\symfony\http-kernel\HttpKernel.php(153): call_user_func_array(Object(Closure), Array) #46 C:\wamp64\www\d8testw\vendor\symfony\http-kernel\HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #47 C:\wamp64\www\d8testw\core\lib\Drupal\Core\StackMiddleware\Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #48 C:\wamp64\www\d8testw\core\lib\Drupal\Core\StackMiddleware\KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #49 C:\wamp64\www\d8testw\core\lib\Drupal\Core\StackMiddleware\ReverseProxyMiddleware.php(47): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #50 C:\wamp64\www\d8testw\core\lib\Drupal\Core\StackMiddleware\NegotiationMiddleware.php(50): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #51 C:\wamp64\www\d8testw\vendor\stack\builder\src\Stack\StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #52 C:\wamp64\www\d8testw\core\lib\Drupal\Core\DrupalKernel.php(657): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #53 C:\wamp64\www\d8testw\index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #54 {main}.
| Comment | File | Size | Author |
|---|---|---|---|
| #33 | paragraphs_clean-type_check-2944545-33.patch | 787 bytes | aaronbauman |
Comments
Comment #3
aaronbaumanI pushed a fix into latest dev
Please update and see if it works to resolve your issue.
If so, i will create a new release.
Comment #4
alisaeedi commentedComment #5
alisaeedi commentedthanks a lot for your quick response
Dev version installed
Yes, It works well. when I delete node with paragraphs, both paragraphs and entities removed (paragraphs removed and admin/content/files tab shows "used in : 0 places")
But I still have problem with editing "manage display" and "manage form"
after clicking "save" button, I see this error :
"The website encountered an unexpected error. Please try again later."
these are PHP errors in dblog :
location : http://localhost/d8testw/admin/structure/types/manage/portfolio/display
LogicException: Getting the base fields is not supported for entity type Entity view display. in Drupal\Core\Entity\EntityFieldManager->buildBaseFieldDefinitions() (ine 199 of C:\wamp64\www\d8testw\core\lib\Drupal\Core\Entity\EntityFieldManager.php).
location : http://localhost/d8testw/admin/structure/types/manage/portfolio/form-display
LogicException: Getting the base fields is not supported for entity type Entity form display. in Drupal\Core\Entity\EntityFieldManager->buildBaseFieldDefinitions() (line 199 of C:\wamp64\www\d8testw\core\lib\Drupal\Core\Entity\EntityFieldManager.php).
Then I have to uninstall module.
Thank you
Comment #6
alisaeedi commentedI run cron and flush all caches, but "Paragraphs clean" dose't delete paragraphs and entities that created before installing this module, is there any solution for this problem ?
Comment #7
alisaeedi commentedI can't change block position too! and I ensounter same error :
LogicException: Getting the base fields is not supported for entity type Block. in Drupal\Core\Entity\EntityFieldManager->buildBaseFieldDefinitions() (line 199 of C:\wamp64\www\drupal8\core\lib\Drupal\Core\Entity\EntityFieldManager.php).
Comment #8
joshua.roberson commented"8.x-1.x-dev" doesn't delete the paragraph entity when removed.
It might have something to do with you renaming the function from "paragraphs_clean_entity_presave" to "paragraphs_clean_entity_update".
The function name is used as the static variable name.
The "paragraphs_clean_do_delete" function is still looking for the old function name.
Maybe you could add the patch file to this story so others might be able to contribute?
Comment #9
joshua.roberson commentedComment #10
joshua.roberson commentedI couldn't clone "8.x-1.x-dev", so this patch is for "8.x-1.x". I tested it and it worked every time with no PHP errors. Removed paragraphs were deleted from the "paragraphs_item" table.
I also checked this file with Coder Sniffer and fixed a few things.
Comment #11
joshua.roberson commentedComment #12
flashwebcenterThe patch in #10 is working fine with "8.x-1.x-dev".
Comment #13
alisaeedi commentedThanks joshua.roberson
Patch is working,
But I still have problem with editing "manage display" and "manage form"
and I still can't change block position in "block display" when module enabled.
Error :
LogicException: Getting the base fields is not supported for entity type Block. in Drupal\Core\Entity\EntityFieldManager->buildBaseFieldDefinitions() (line 201 of C:\wamp64\www\d8testw\core\lib\Drupal\Core\Entity\EntityFieldManager.php).
core updated to 8.5.0
-----------------------------------------------------------------------------------------------------
I tested it in new clean install of drupal 8.5.0, and when I want to change block regions in block layout page, I encounter this error again:
"The website encountered an unexpected error. Please try again later."
php error in recent log messages is:
"LogicException: Getting the base fields is not supported for entity type Block. in Drupal\Core\Entity\EntityFieldManager->buildBaseFieldDefinitions() (line 201 of C:\wamp64\www\d8t01\core\lib\Drupal\Core\Entity\EntityFieldManager.php)."
Comment #14
joshua.roberson commentedI am also experiencing the same error after updating core on Friday. It seems the module is causing it. To test, I disabled the module, cleared cache and placed a block without error. I then re-enabled the module, cleared cache, and placed a block with an error.
Comment #15
joshua.roberson commentedComment #16
joshua.roberson commentedI believe it is fixed now. Problem was "Block" entity types didn't have field definitions, so I added a check to see if the method existed first. I tested again and didn't get any errors placing blocks and was still able to delete paragraphs from nodes.
Comment #17
joshua.roberson commentedComment #19
aaronbaumanOK, I think this patch makes sense.
See if it works to resolve your issues
Comment #20
joshua.roberson commentedLooks like you committed the patch with additional changes while it is still in review. So now the dev branch needs to be tested instead of this patch.
Most of the changes you made look like they will work. This change in particular might cause unnecessary code execution if the field is not a paragraph type but does have entity reference revisions. The "Entity Reference Revisions" module indicate that it can be used by non Paragraph entities.
Patch (must be a paragraph type and have revisions):
Committed (can be a paragraph type or have revisions):
Comment #21
aaronbaumanI reviewed the patch and decided it was good to go - i realize that this is not standard, but i'm trying to keep this project moving quickly, since it's merely a stopgap until the parent issue gets resolved, which has dragged on and on for years now.
i did make a couple changes to the patch to break earlier, including this one:
BOOL && BOOL is the inverse of !BOOL || !BOOL, so this is logically equivalent.
Comment #22
joshua.roberson commentedI just ran a few tests and didn't get any errors.
Comment #23
joshua.roberson commentedComment #24
alisaeedi commentedjoshua.roberson, Thanks a lot
The patch in #16 is working fine for me, and my problem solved with your help
But I see new error when I want to change order in --> structure/types/manage/page/display
"The website encountered an unexpected error. Please try again later."
Error is :
Error: Call to protected method Drupal\Core\Entity\EntityDisplayBase::getFieldDefinitions() from context '' in paragraphs_clean_entity_update() (line 20 of C:\wamp64\www\d8t01\modules\paragraphs_clean\paragraphs_clean.module) #0 [internal function]: paragraphs_clean_entity_update(Object(Drupal\Core\Entity\Entity\EntityViewDisplay), 'entity_view_dis...') #1 C:\wamp64\www\d8t01\core\lib\Drupal\Core\Extension\ModuleHandler.php(402): call_user_func_array('paragraphs_clea...', Array) #2 C:\wamp64\www\d8t01\core\lib\Drupal\Core\Config\Entity\ConfigEntityStorage.php(378): Drupal\Core\Extension\ModuleHandler->invokeAll('entity_update', Array) #3 C:\wamp64\www\d8t01\core\lib\Drupal\Core\Entity\EntityStorageBase.php(470): Drupal\Core\Config\Entity\ConfigEntityStorage->invokeHook('update', Object(Drupal\Core\Entity\Entity\EntityViewDisplay)) #4 C:\wamp64\www\d8t01\core\lib\Drupal\Core\Entity\EntityStorageBase.php(395): Drupal\Core\Entity\EntityStorageBase->doPostSave(Object(Drupal\Core\Entity\Entity\EntityViewDisplay), true) #5 C:\wamp64\www\d8t01\core\lib\Drupal\Core\Config\Entity\ConfigEntityStorage.php(259): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\Core\Entity\Entity\EntityViewDisplay)) #6 C:\wamp64\www\d8t01\core\lib\Drupal\Core\Entity\Entity.php(387): Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object(Drupal\Core\Entity\Entity\EntityViewDisplay)) #7 C:\wamp64\www\d8t01\core\lib\Drupal\Core\Config\Entity\ConfigEntityBase.php(637): Drupal\Core\Entity\Entity->save() #8 C:\wamp64\www\d8t01\core\lib\Drupal\Core\Entity\EntityForm.php(285): Drupal\Core\Config\Entity\ConfigEntityBase->save() #9 [internal function]: Drupal\Core\Entity\EntityForm->save(Array, Object(Drupal\Core\Form\FormState)) #10 C:\wamp64\www\d8t01\core\lib\Drupal\Core\Form\FormSubmitter.php(111): call_user_func_array(Array, Array) #11 C:\wamp64\www\d8t01\core\lib\Drupal\Core\Form\FormSubmitter.php(51): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object(Drupal\Core\Form\FormState)) #12 C:\wamp64\www\d8t01\core\lib\Drupal\Core\Form\FormBuilder.php(585): Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object(Drupal\Core\Form\FormState)) #13 C:\wamp64\www\d8t01\core\lib\Drupal\Core\Form\FormBuilder.php(314): Drupal\Core\Form\FormBuilder->processForm('entity_view_dis...', Array, Object(Drupal\Core\Form\FormState)) #14 C:\wamp64\www\d8t01\core\lib\Drupal\Core\Controller\FormController.php(74): Drupal\Core\Form\FormBuilder->buildForm('entity_view_dis...', Object(Drupal\Core\Form\FormState)) #15 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch)) #16 C:\wamp64\www\d8t01\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #17 C:\wamp64\www\d8t01\core\lib\Drupal\Core\Render\Renderer.php(582): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #18 C:\wamp64\www\d8t01\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #19 C:\wamp64\www\d8t01\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #20 C:\wamp64\www\d8t01\vendor\symfony\http-kernel\HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #21 C:\wamp64\www\d8t01\vendor\symfony\http-kernel\HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #22 C:\wamp64\www\d8t01\core\lib\Drupal\Core\StackMiddleware\Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #23 C:\wamp64\www\d8t01\core\lib\Drupal\Core\StackMiddleware\KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #24 C:\wamp64\www\d8t01\core\modules\page_cache\src\StackMiddleware\PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #25 C:\wamp64\www\d8t01\core\modules\page_cache\src\StackMiddleware\PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #26 C:\wamp64\www\d8t01\core\lib\Drupal\Core\StackMiddleware\ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #27 C:\wamp64\www\d8t01\core\lib\Drupal\Core\StackMiddleware\NegotiationMiddleware.php(50): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #28 C:\wamp64\www\d8t01\vendor\stack\builder\src\Stack\StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #29 C:\wamp64\www\d8t01\core\lib\Drupal\Core\DrupalKernel.php(657): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #30 C:\wamp64\www\d8t01\index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #31 {main}.
Comment #25
aaronbaumanLooks like we need to go back to fetching field definitions from the service, rather than using this protected method
Comment #26
joshua.roberson commentedWhen using the following code on the content type manage display page and sorting the fields:
I get this error:
LogicException: Getting the base fields is not supported for entity type Entity view display. in Drupal\Core\Entity\EntityFieldManager->buildBaseFieldDefinitions() (line 201 of /Sites/gitrepos/pantheon_hartenergy/core/lib/Drupal/Core/Entity/EntityFieldManager.php).Another option might be to specify which entity types this code can execute on such as "Block Content", "Node", and maybe some others that have fields? I don't like this approach since it limits the functionality in cases where new entities are introduced in the future.
Comment #27
joshua.roberson commentedThis patch restricts it to "node" and "block_content" entity types which tests were successful. I didn't need to add the "paragraph" entity type since it cleans itself when deleted. I didn't get any errors placing blocks in a region. I didn't get any errors when changing the field display order on content types.
This is probably the least error prone way to implement this and is potentially future safe. If you find there are other entity types that allow for paragraph fields to be added, then add those entity types to the switch.
Comment #28
joshua.roberson commentedComment #29
joshua.roberson commentedYou could also move the logic to a helper function and do away with the switch. Call the helper function using "hook_ENTITY_TYPE_update()".
Comment #30
joshua.roberson commentedHere is the patch using "hook_ENTITY_TYPE_update()" which is probably better.
Comment #31
aaronbaumanThe way to do this is to short circut based on whether the given entity implements FieldableEntityInterface
Also, doing the same thing on hook_update and hook_delete doesn't make any sense.
None of the entity field values will change on hook_delete, so we cannot use the approach of comparing the changes.
Comment #32
joshua.roberson commented"hook_delete" wasn't used in the patch. The"_paragraphs_clean_delete()" function is just a helper function that only gets executed when called and is there to contain reusable code. Please, add a patch of what you think it should be.
Comment #33
aaronbaumanah, yes i see now.
my bad, i was reading too quickly.
This should do it.
Comment #34
joshua.roberson commentedHere is the patch I was working on which checks to make sure the "baseFieldDefinitions" method exists. It doesn't exist for test 4 and 5 below which works out. Use which ever patch works.
Performed the following tests with no errors:
Comment #35
aaronbaumanFieldableEntityInterfacedefinespublic function getFieldDefinitions, so #33 is a more straightforward approach than checking for method existence. please reviewComment #36
joshua.roberson commentedI ran the same tests against patch #33. I didn't get any errors, but it didn't delete the paragraph from the "paragraphs_item" table.
Can you review patch #34?
Comment #37
joshua.roberson commentedI need to retest patch #33. I missed the "use" line.
Comment #38
joshua.roberson commentedLooks like patch #33 works with no errors. I agree, it is a better approach instead of looking for methods.
Comment #39
joshua.roberson commentedComment #40
alisaeedi commented#33 works perfect, without any errors. Thanks
Comment #42
aaronbaumanThanks all - #33 committed
Comment #44
ravi shankar karnati commentedI have tried to apply the #13 provided patch using the composer and patch is not applying and it throwing the below error. To apply the patch manually also lines are not matching as per the patch VS paragraphs_clean.module, please guide me how to fix this issue.
Composer patch apply error: Could not apply patch! Skipping. The error was: Cannot apply patch https://www.drupal.org/files/issues/2018-03-16/paragraphs_clean-type_che...
Note: I wanted to fix the "Getting the base fields is not supported for entity type Block" error when saved the blocks in the drupal system.
Thanks.
Comment #45
joachim namysloThis thing is still valid. Got it right now try to reproduce it again and giving some details asap.