public function getStructure(NeoFieldType $fieldType)
{
$owner = $fieldType->element;
$field = $fieldType->model;
$locale = $this->_getFieldLocale($fieldType);
$result = craft()->db->createCommand()->select('structureId')->from('neoblockstructures')->where('ownerId = :ownerId', [':ownerId' => $owner->id])->andWhere('fieldId = :fieldId', [':fieldId' => $field->id]);
if ($locale) {
$result = $result->andWhere('ownerLocale = :ownerLocale', [':ownerLocale' => $locale]);
} else {
$result = $result->andWhere('ownerLocale IS NULL');
}
$result = $result->queryRow();
if ($result) {
return craft()->structures->getStructureById($result['structureId']);
}
return false;
}