The code in twitter_post_field_attach_form() function uses $form_state['field'] without checking of its existence. This property does not exist when entity without fields is editing. The patch fixes this.

P.S. It's better not to load all the twitter code if the form contains no twitter related fields. It is another issue which can be solved.

CommentFileSizeAuthor
twitter-entities_without_fields.patch639 bytesmaximpodorov
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

andypost’s picture

+++ b/twitter_post/twitter_post.field.inc
@@ -134,6 +134,9 @@ function twitter_post_field_is_empty($item, $field) {
 function twitter_post_field_attach_form($entity_type, $entity, &$form, &$form_state, $langcode) {
+  if (empty($form_state['field'])) {

Probably you need to use field_info_* some function to make sure that no fields defined

maximpodorov’s picture

Anyway, you should check (not omnipresent) array element existence before using it.

DamienMcKenna’s picture

Status: Needs review » Reviewed & tested by the community

Short & simple.

DamienMcKenna’s picture

DamienMcKenna’s picture

Status: Reviewed & tested by the community » Needs review

Triggering the testbot.

DamienMcKenna’s picture

Status: Needs review » Fixed

Committed. Thanks.

Status: Fixed » Closed (fixed)

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