Body: <p>I wrote a simple fieldtype that checks that the field value is unique for a specific entry type: <a href="https://github.com/fuel-digital/Craft-Unique-Text-FieldType" rel="nofollow">https://github.com/fuel-digital/Craft-Unique-Text-FieldType</a></p>
  
  <p>This worked fine initially but after the recent core updates, $this->element in the valueExists() method is null on new entries, where previously it was an instance of ElementType::Entry or whatever else the field was attached to.</p>
  
  <p>While I could instantiate a new ElementType::Entry object if one doesn't exist, this limits the field's use to Entries, and not Assets, Users etc.</p>
  
  <p>Is there some other way of getting the element's value now? I can't see anything when inspecting the field class.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-01-06T19:32:50.533Z
Comments.Text: `$this->element` won't necessarily be set depending on the context your field type is used in, so your field type needs to be aware of that. That's always been the case, too, so I doubt a recent update changed anything related to that.
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-01-06T21:08:37.453Z
Comments.Text: Weird, as it was fine in testing until recently. Any suggestions on how I can achieve what I'm looking to do?
Comments.UserDisplayName: Russ Back
Tags: <plugin-development><entry-type>
Title: Can no longer get the ElementType a field is attached to
ThreadText: # Can no longer get the ElementType a field is attached to
  
  (Asked by: username_0 on 2015-01-05)
  
  I wrote a simple fieldtype that checks that the field value is unique for a specific entry type: <https://github.com/fuel-digital/Craft-Unique-Text-FieldType>
  
  This worked fine initially but after the recent core updates, $this->element in the valueExists() method is null on new entries, where previously it was an instance of ElementType::Entry or whatever else the field was attached to.
  
  While I could instantiate a new ElementType::Entry object if one doesn't exist, this limits the field's use to Entries, and not Assets, Users etc.
  
  Is there some other way of getting the element's value now? I can't see anything when inspecting the field class.
  
  **Tags:** plugin-development, entry-type
  
  > **Comments:**
  > **username_1**: `$this->element` won't necessarily be set depending on the context your field type is used in, so your field type needs to be aware of that. That's always been the case, too, so I doubt a recent update changed anything related to that.  
  > **username_0**: Weird, as it was fine in testing until recently. Any suggestions on how I can achieve what I'm looking to do?  
  
  ---
  
  ## 0 answers
  
  