I did a clean install of Drupal 8.3.7 and Tablefield 2.x-dev, and while I can add a TableField field to a content type, I am unable to use it because of the following errors:

Warning: ksort() expects parameter 1 to be array, string given in Drupal\tablefield\Plugin\Field\FieldType\TablefieldItem->setValue() (line 168 of modules/drupal/tablefield/src/Plugin/Field/FieldType/TablefieldItem.php).
Drupal\tablefield\Plugin\Field\FieldType\TablefieldItem->setValue(Array, ) (Line: 195)
Drupal\Core\TypedData\TypedDataManager->getPropertyInstance(Object, 0, Array) (Line: 82)
Drupal\Core\Field\FieldTypePluginManager->createFieldItem(Object, 0, Array) (Line: 40)
Drupal\Core\Field\FieldItemList->createItem(0, Array) (Line: 66)
Drupal\Core\TypedData\Plugin\DataType\ItemList->setValue(Array, 1) (Line: 118)
Drupal\Core\Field\FieldItemList->setValue(Array, 1) (Line: 181)
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('field_config_edit_form', 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: 38)
Drupal\jsonapi\StackMiddleware\FormatSetter->handle(Object, 1, 1) (Line: 40)
Asm89\Stack\Cors->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: 656)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ebeyrent created an issue. See original summary.

lolandese’s picture

Status: Active » Needs review
FileSize
520 bytes

Wrapping ksort in a conditional is_array().

  • lolandese committed 5303332 on 8.x-2.x
    Issue #2925388 by lolandese:  ksort() expects parameter 1 to be array
    
lolandese’s picture

Priority: Critical » Major
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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