Commit a6658cdd authored by alexpott's avatar alexpott

Issue #2193237 by czigor, amateescu, barraponto, revagomes, rodrigo panchiniak...

Issue #2193237 by czigor, amateescu, barraponto, revagomes, rodrigo panchiniak fernandes: Warning because of empty value at array_flip().
parent b8c062c0
......@@ -71,8 +71,10 @@ public function settingsSummary() {
*/
public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, array &$form_state) {
$tags = array();
foreach ($items as $item) {
$tags[] = isset($item->entity) ? $item->entity : entity_load('taxonomy_term', $item->target_id);
if (!$items->isEmpty()) {
foreach ($items as $item) {
$tags[] = isset($item->entity) ? $item->entity : entity_load('taxonomy_term', $item->target_id);
}
}
$element += array(
'#type' => 'textfield',
......
......@@ -17,7 +17,7 @@ class TermFieldTest extends TaxonomyTestBase {
*
* @var array
*/
public static $modules = array('entity_test');
public static $modules = array('entity_test', 'field_ui');
protected $instance;
protected $vocabulary;
......@@ -37,6 +37,7 @@ function setUp() {
'view test entity',
'administer entity_test content',
'administer taxonomy',
'administer entity_test fields',
));
$this->drupalLogin($web_user);
$this->vocabulary = $this->createVocabulary();
......@@ -128,6 +129,20 @@ function testTaxonomyTermFieldWidgets() {
$this->assertNoFieldByName($this->field_name, '', 'Widget is not displayed.');
}
/**
* No php error message on the field setting page for autocomplete widget.
*/
function testTaxonomyTermFieldInstanceSettingsAutocompleteWidget() {
entity_get_form_display('entity_test', 'entity_test', 'default')
->setComponent($this->field_name, array(
'type' => 'taxonomy_autocomplete',
'weight' => 1,
))
->save();
$this->drupalGet('entity_test/structure/entity_test/fields/entity_test.entity_test.' . $this->field_name);
$this->assertNoErrorsLogged();
}
/**
* Tests that vocabulary machine name changes are mirrored in field definitions.
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment