diff --git a/config/linkimagefield.basic.yml b/config/linkimagefield.basic.yml
new file mode 100644
index 0000000..10fc8b1
--- /dev/null
+++ b/config/linkimagefield.basic.yml
@@ -0,0 +1 @@
+image_longdesc_length: '500'
\ No newline at end of file
diff --git a/lib/Drupal/linkimagefield/Plugin/Field/FieldFormatter/LinkImageFieldFormatter.php b/lib/Drupal/linkimagefield/Plugin/Field/FieldFormatter/LinkImageFieldFormatter.php
new file mode 100644
index 0000000..7a74dc6
--- /dev/null
+++ b/lib/Drupal/linkimagefield/Plugin/Field/FieldFormatter/LinkImageFieldFormatter.php
@@ -0,0 +1,53 @@
+<?php
+
+namespace Drupal\linkimagefield\Plugin\Field\FieldFormatter;
+
+use Drupal\image\Plugin\Field\FieldFormatter\ImageFormatter;
+use Drupal\Core\Field\FieldItemListInterface;
+
+/**
+ * Plugin implementation of the 'image' formatter.
+ *
+ * @FieldFormatter(
+ *   id = "linkimagefield",
+ *   label = @Translation("Link Image"),
+ *   field_types = {
+ *     "linkimagefield"
+ *   }
+ * )
+ */
+class LinkImageFieldFormatter extends ImageFormatter {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function settingsForm(array $form, array &$form_state) {
+    $element = parent::settingsForm($form, $form_state);
+    unset($element['image_link']);
+    return $element;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function viewElements(FieldItemListInterface $items) {
+    $elements = array();
+    $settings = $this->getSettings();
+
+    foreach ($items as $delta => $item) {
+
+      // Extract field item attributes for the theme function, and unset them
+      // from the $item so that the field template does not re-render them.
+      $item_attributes = $item->_attributes;
+      unset($item->_attributes);
+
+      $elements[$delta] = array(
+        '#theme' => 'linkimage_formatter',
+        '#item' => $item,
+        '#image_style' => $settings['image_style'],
+        '#item_attributes' => $item_attributes,
+      );
+    }
+    return $elements;
+  }
+} 
\ No newline at end of file
diff --git a/lib/Drupal/linkimagefield/Plugin/Field/FieldType/LinkImageField.php b/lib/Drupal/linkimagefield/Plugin/Field/FieldType/LinkImageField.php
new file mode 100644
index 0000000..b25ec14
--- /dev/null
+++ b/lib/Drupal/linkimagefield/Plugin/Field/FieldType/LinkImageField.php
@@ -0,0 +1,187 @@
+<?php
+
+namespace Drupal\linkimagefield\Plugin\Field\FieldType;
+
+use Drupal\Core\Field\FieldDefinitionInterface;
+use Drupal\image\Plugin\Field\FieldType\ImageItem;
+
+/**
+ * Plugin implementation of the 'LinkImageField' field type.
+ *
+ * @FieldType(
+ *   id = "linkimagefield",
+ *   label = @Translation("Link Image"),
+ *   description = @Translation("An edit widget for image files that display as a link, including a preview of the image."),
+ *   default_widget = "linkimagefield_widget",
+ *   default_formatter = "linkimagefield"
+ * )
+ */
+
+class LinkImageField extends ImageItem {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function defaultInstanceSettings() {
+    return array(
+      'longdesc_field' => '0',
+      'url_settings' => array(
+        'url' => '',
+        'rel_field' => '0',
+        'class_field' => '0',
+        'custom_target' => '0',
+        'target' => '_self',
+      ),
+    ) + parent::defaultInstanceSettings();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function schema(FieldDefinitionInterface $field_definition) {
+    return array(
+      'columns' => array(
+        'target_id' => array(
+          'description' => 'The ID of the file entity.',
+          'type' => 'int',
+          'not null' => FALSE,
+          'unsigned' => TRUE,
+        ),
+        'alt' => array(
+          'description' => "Alternative image text, for the image's 'alt' attribute.",
+          'type' => 'varchar',
+          'length' => 128,
+          'not null' => FALSE,
+        ),
+        'longdesc' => array(
+          'description' => "A link to a page with a long description of the image, for the image's 'londesc' attribute.",
+          'type' => 'varchar',
+          'length' => 128,
+          'not null' => FALSE,
+        ),
+        'title' => array(
+          'description' => "Image title text, for the image's 'title' attribute.",
+          'type' => 'varchar',
+          'length' => 128,
+          'not null' => FALSE,
+        ),
+        'url' => array(
+          'description' => "The URL used for the image link.",
+          'type' => 'varchar',
+          'length' => 128,
+          'not null' => FALSE,
+        ),
+        'target' => array(
+          'description' => "The target type of the image link.",
+          'type' => 'varchar',
+          'length' => 128,
+          'not null' => FALSE,
+        ),
+        'class' => array(
+          'description' => "For adding a class attribute to the anchor.",
+          'type' => 'varchar',
+          'length' => 128,
+          'not null' => FALSE,
+        ),
+        'rel' => array(
+          'description' => "A relation tag for bots or lightboxes.",
+          'type' => 'varchar',
+          'length' => 128,
+          'not null' => FALSE,
+        ),
+        'width' => array(
+          'description' => 'The width of the image in pixels.',
+          'type' => 'int',
+          'unsigned' => TRUE,
+        ),
+        'height' => array(
+          'description' => 'The height of the image in pixels.',
+          'type' => 'int',
+          'unsigned' => TRUE,
+        ),
+      ),
+      'indexes' => array(
+        'target_id' => array('target_id'),
+      ),
+      'foreign keys' => array(
+        'target_id' => array(
+          'table' => 'file_managed',
+          'columns' => array('target_id' => 'fid'),
+        ),
+      ),
+    );
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function propertyDefinitions(FieldDefinitionInterface $field_definition) {
+    $properties = parent::propertyDefinitions($field_definition);
+    return $properties;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function instanceSettingsForm(array $form, array &$form_state) {
+    $element = parent::instanceSettingsForm($form, $form_state);
+    $settings = $this->getSettings();
+
+    $element['url_settings'] = array(
+      '#type' => 'details',
+      '#title' => t('URL Link settings'),
+      '#open' => TRUE,
+      '#weight' => 0,
+    );
+
+    $element['url_settings']['url'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Default URL'),
+      '#description' => t('Provide a well-formed URL.  This will be the default url linked to by provided images.'),
+      '#default_value' => $settings['url_settings']['url'],
+      '#maxlength' => '255',
+    );
+
+    $element['url_settings']['rel_field'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Enable link <em>rel</em> field'),
+      '#default_value' => $settings['url_settings']['rel_field'],
+      '#description' => t('Allow rel attributes to be added to links'),
+    );
+
+    $element['url_settings']['class_field'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Enable link <em>class</em> field'),
+      '#default_value' => $settings['url_settings']['class_field'],
+      '#description' => t('Allow classes to be added to links'),
+    );
+
+    $target_options = _linkimagefield_widget_url_target_options();
+
+    $element['url_settings']['custom_target'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Enable custom target'),
+      '#default_value' =>  $settings['url_settings']['custom_target'],
+      '#description' => t('Enable user to provide alternate target frame for link.'),
+    );
+
+    $element['url_settings']['target'] = array(
+      '#type' => 'select',
+      '#title' => t('Default Target'),
+      '#description' => t('Select a default target type.'),
+      '#default_value' => $settings['url_settings']['target'],
+      '#options' => $target_options,
+      '#maxlength' => '255',
+    );
+
+    $element['longdesc_field'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Enable <em>Longdesc</em> field'),
+      '#default_value' => $settings['longdesc_field'],
+      '#description' => t('Allow the longdesc attribute to be added to images'),
+      '#weight' => 10,
+    );
+
+    return $element;
+  }
+} 
\ No newline at end of file
diff --git a/lib/Drupal/linkimagefield/Plugin/Field/FieldWidget/LinkImageFieldWidget.php b/lib/Drupal/linkimagefield/Plugin/Field/FieldWidget/LinkImageFieldWidget.php
new file mode 100644
index 0000000..201d57b
--- /dev/null
+++ b/lib/Drupal/linkimagefield/Plugin/Field/FieldWidget/LinkImageFieldWidget.php
@@ -0,0 +1,99 @@
+<?php
+
+namespace Drupal\linkimagefield\Plugin\Field\FieldWidget;
+
+use Drupal\image\Plugin\Field\FieldWidget\ImageWidget;
+use Drupal\Core\Field\FieldItemListInterface;
+
+/**
+ * Plugin implementation of the 'linkimagefield' widget.
+ *
+ * @FieldWidget(
+ *   id = "linkimagefield_widget",
+ *   label = @Translation("Link Image"),
+ *   field_types = {
+ *     "linkimagefield"
+ *   }
+ * )
+ */
+class LinkImageFieldWidget extends ImageWidget {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, array &$form_state) {
+    $element = parent::formElement($items, $delta, $element, $form, $form_state);
+
+    $element['#process'][] = array(get_class($this), 'process');
+
+    // Allow to use settings in process function.
+    $settings = $this->getFieldSettings();
+    $element['#url'] = $settings['url_settings']['url'];
+    $element['#rel_field'] = $settings['url_settings']['rel_field'];
+    $element['#class_field'] = $settings['url_settings']['class_field'];
+    $element['#custom_target'] = $settings['url_settings']['custom_target'];
+    $element['#target'] = $settings['url_settings']['target'];
+    $element['#longdesc_field'] = $settings['longdesc_field'];
+    return $element;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function process($element, &$form_state, $form) {
+    $element = parent::process($element, $form_state, $form);
+
+    $item = $element['#value'];
+    $item['fids'] = $element['fids']['#value'];
+
+    $element['url'] = array(
+      '#title' => t('Link URL'),
+      '#type' => 'textfield',
+      '#default_value' => isset($item['url']) ? $item['url'] : $element['#url'],
+      '#description' => t('This URL will be loaded when the image is clicked'),
+      '#weight' => -4,
+      '#access' => (bool) $item['fids'],
+    );
+    $element['rel'] = array(
+      '#title' => t('Link Rel'),
+      '#type' => 'textfield',
+      '#default_value' => isset($item['rel']) ? $item['rel'] : '',
+      '#description' => t('Add rel attributes for bots, lightbox galleries, etc...'),
+      '#maxlength' => \Drupal::config('linkimagefield.basic')->get('image_longdesc_length'),
+      '#weight' => -4,
+      '#access' => (bool) $item['fids'] && $element['#rel_field'],
+    );
+    $element['class'] = array(
+      '#title' => t('Link Class'),
+      '#type' => 'textfield',
+      '#default_value' => isset($item['class']) ? $item['class'] : '',
+      '#description' => t('Add classes for theming, colorboxes, etc...'),
+      '#maxlength' => \Drupal::config('linkimagefield.basic')->get('image_longdesc_length'),
+      '#weight' => -4,
+      '#access' => (bool) $item['fids'] && $element['#class_field'],
+    );
+    $custom_target = $element['#custom_target'];
+    $options = array('default' => t('Use Default') . ' (' . $element['#target'] . ')') + _linkimagefield_widget_url_target_options();
+    $element['target'] = array(
+      '#title' => t('Link Target'),
+      '#type' => $custom_target ? 'select' : 'value',
+      '#options' => $custom_target ? $options : NULL,
+      '#default_value' => $custom_target && isset($item['target']) ? $item['target'] : $element['#target'],
+      '#description'   => t('Window/Frame Target for the URL'),
+      '#weight' => -4,
+      '#access' => (bool) $item['fids'] && $custom_target,
+    );
+
+    $element['longdesc'] = array(
+      '#title' => t('Image Longdesc'),
+      '#type' => 'textfield',
+      '#default_value' => isset($item['longdesc']) ? $item['longdesc'] : '',
+      '#description' => t('The longdesc is used to provide a link to a long description of the image.'),
+      '#maxlength' => \Drupal::config('linkimagefield.basic')->get('image_longdesc_length'),
+      '#weight' => -1,
+      '#access' => (bool) $item['fids'] && $element['#longdesc_field'],
+    );
+
+    return $element;
+  }
+} 
\ No newline at end of file
diff --git a/linkimagefield.info b/linkimagefield.info
deleted file mode 100644
index dd1f32f..0000000
--- a/linkimagefield.info
+++ /dev/null
@@ -1,13 +0,0 @@
-name = LinkImage
-description = Defines an link image field type.
-dependencies[] = field
-dependencies[] = image
-package = Fields
-core = 7.x
-
-; Information added by drupal.org packaging script on 2012-05-21
-version = "7.x-1.x-dev"
-core = "7.x"
-project = "linkimagefields"
-datestamp = "1337560004"
-
diff --git a/linkimagefield.info.yml b/linkimagefield.info.yml
new file mode 100644
index 0000000..2769359
--- /dev/null
+++ b/linkimagefield.info.yml
@@ -0,0 +1,8 @@
+name: LinkImage
+type: module
+description: 'Defines an link image field type.'
+dependencies:
+ - field
+ - image
+package: Fields
+core: 8.x
\ No newline at end of file
diff --git a/linkimagefield.install b/linkimagefield.install
deleted file mode 100644
index 215c48b..0000000
--- a/linkimagefield.install
+++ /dev/null
@@ -1,86 +0,0 @@
-<?php
-// $Id$
-
-/**
- * @file
- *
- * linkimagefield install and update code.
- * Defines the field schema.
- */
-
-/**
- * Implements hook_field_schema().
- */
-function linkimagefield_field_schema($field) {
-  return array(
-    'columns' => array(
-      'fid' => array(
-        'description' => 'The {file_managed}.fid being referenced in this field.',
-        'type' => 'int',
-        'not null' => FALSE,
-        'unsigned' => TRUE,
-      ),
-      'alt' => array(
-        'description' => "Alternative image text, for the image's 'alt' attribute.",
-        'type' => 'varchar',
-        'length' => 128,
-        'not null' => FALSE,
-      ),
-      'longdesc' => array(
-        'description' => "A link to a page with a long description of the image, for the image's 'londesc' attribute.",
-        'type' => 'varchar',
-        'length' => 128,
-        'not null' => FALSE,
-      ),
-      'title' => array(
-        'description' => "Image title text, for the image's 'title' attribute.",
-        'type' => 'varchar',
-        'length' => 128,
-        'not null' => FALSE,
-      ),
-      'url' => array(
-        'description' => "The URL used for the image link.",
-        'type' => 'varchar',
-        'length' => 128,
-        'not null' => FALSE,
-      ),
-      'target' => array(
-        'description' => "The target type of the image link.",
-        'type' => 'varchar',
-        'length' => 128,
-        'not null' => FALSE,
-      ),
-      'class' => array(
-        'description' => "For adding a class attribute to the anchor.",
-        'type' => 'varchar',
-        'length' => 128,
-        'not null' => FALSE,
-      ),
-      'rel' => array(
-        'description' => "A relation tag for bots or lightboxes.",
-        'type' => 'varchar',
-        'length' => 128,
-        'not null' => FALSE,
-      ),
-      'width' => array(
-        'description' => 'The width of the image in pixels.',
-        'type' => 'int',
-        'unsigned' => TRUE,
-      ),
-      'height' => array(
-        'description' => 'The height of the image in pixels.',
-        'type' => 'int',
-        'unsigned' => TRUE,
-      ),
-    ),
-    'indexes' => array(
-      'fid' => array('fid'),
-    ),
-    'foreign keys' => array(
-      'fid' => array(
-        'table' => 'file_managed',
-        'columns' => array('fid' => 'fid'),
-      ),
-    ),
-  );
-}
diff --git a/linkimagefield.module b/linkimagefield.module
index 2cb8fc5..cd0dd3d 100644
--- a/linkimagefield.module
+++ b/linkimagefield.module
@@ -2,425 +2,77 @@
 
 /**
  * @file
- * Defines a link image field type.
+ * Defines theming for a link image field.
  */
 
 /**
- * Implements hook_field_info().
- */
-function linkimagefield_field_info() {
-  return array(
-    'linkimagefield' => array(
-      'label' => t('Link Image'),
-      'description' => t('An edit widget for image files that display as a link, including a preview of the image.'),
-      'settings' => array(
-        'uri_scheme' => variable_get('file_default_scheme', 'public'),
-        'default_image' => 0,
-      ),
-      'instance_settings' => array(
-        'file_extensions' => 'png gif jpg jpeg',
-        'file_directory' => '',
-        'max_filesize' => '',
-        'alt_field' => 0,
-        'longdesc_field' => 0,
-        'title_field' => 0,
-        'rel_field' => 0,
-        'class_field' => 0,
-        'max_resolution' => '',
-        'min_resolution' => '',
-        'url' => '',
-        'custom_target' => 0,
-        'target' => '_self',
-      ),
-      'default_widget' => 'linkimagefield_widget',
-      'default_formatter' => 'linkimagefield',
-    ),
-  );
-}
-
-/**
- * Implements hook_field_settings_form().
- */
-function linkimagefield_field_settings_form($field, $instance) {
-  return image_field_settings_form($field, $instance);
-}
-
-/**
- * Implements hook_field_instance_settings_form().
- */
-function linkimagefield_field_instance_settings_form($field, $instance) {
-  // Use the image field instance settings form as a basis.
-  $form = image_field_instance_settings_form($field, $instance);
-
-  $settings = (isset($instance['settings']['url_settings']) ? $instance['settings']['url_settings'] : $instance['settings']);
-
-  $form['url_settings'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('URL Link settings'),
-    '#collapsible' => TRUE,
-    '#collapsed' => FALSE,
-    '#weight' => 0,
-  );
-
-  $form['url_settings']['url'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Default URL'),
-    '#description' => t('Provide a well-formed URL.  This will be the default url linked to by provided images.'),
-    '#default_value' => $settings['url'],
-    '#maxlength' => '255',
-  );
-
-
-  $form['url_settings']['rel_field'] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Enable link <em>rel</em> field'),
-    '#default_value' => $settings['rel_field'],
-    '#description' => t('Allow rel attributes to be added to links'),
-  );
-
-  $form['url_settings']['class_field'] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Enable link <em>class</em> field'),
-    '#default_value' => $settings['class_field'],
-    '#description' => t('Allow classes to be added to links'),
-  );
-
-  $target_options = _linkimagefield_widget_url_target_options();
-
-  $form['url_settings']['custom_target'] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Enable custom target'),
-    '#default_value' =>  $settings['custom_target'],
-    '#description' => t('Enable user to provide alternate target frame for link.'),
-  );
-
-  $form['url_settings']['target'] = array(
-    '#type' => 'select',
-    '#title' => t('Default Target'),
-    '#description' => t('Select a default target type.'),
-    '#default_value' => !empty($settings['target']) ? $settings['target'] : '_self',
-    '#options' => $target_options,
-    '#maxlength' => '255',
-  );
-
-  $form['longdesc_field'] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Enable <em>Longdesc</em> field'),
-    '#default_value' => $instance['settings']['longdesc_field'],
-    '#description' => t('Allow the longdesc attribute to be added to images'),
-    '#weight' => 10,
-  );
-  return $form;
-}
-
-/**
- * Implements hook_field_load().
- */
-function linkimagefield_field_load($entity_type, $entities, $field, $instances, $langcode, &$items, $age) {
-  file_field_load($entity_type, $entities, $field, $instances, $langcode, $items, $age);
-}
-
-/**
- * Implements hook_field_prepare_view().
- */
-function linkimagefield_field_prepare_view($entity_type, $entities, $field, $instances, $langcode, &$items) {
-  return image_field_prepare_view($entity_type, $entities, $field, $instances, $langcode, $items);
-}
-
-/**
- * Implements hook_field_presave().
- */
-function linkimagefield_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items) {
-  file_field_presave($entity_type, $entity, $field, $instance, $langcode, $items);
-}
-
-/**
- * Implements hook_field_insert().
- */
-function linkimagefield_field_insert($entity_type, $entity, $field, $instance, $langcode, &$items) {
-  file_field_insert($entity_type, $entity, $field, $instance, $langcode, $items);
-}
-
-/**
- * Implements hook_field_update().
- */
-function linkimagefield_field_update($entity_type, $entity, $field, $instance, $langcode, &$items) {
-  file_field_update($entity_type, $entity, $field, $instance, $langcode, $items);
-}
-
-/**
- * Implements hook_field_delete().
- */
-function linkimagefield_field_delete($entity_type, $entity, $field, $instance, $langcode, &$items) {
-  file_field_delete($entity_type, $entity, $field, $instance, $langcode, $items);
-}
-
-/**
- * Implements hook_field_delete_revision().
- */
-function linkimagefield_field_delete_revision($entity_type, $entity, $field, $instance, $langcode, &$items) {
-  file_field_delete_revision($entity_type, $entity, $field, $instance, $langcode, $items);
-}
-
-/**
- * Implements hook_field_is_empty().
- */
-function linkimagefield_field_is_empty($item, $field) {
-  return file_field_is_empty($item, $field);
-}
-
-/**
- * Implements hook_field_widget_info().
- */
-function linkimagefield_field_widget_info() {
-  return array(
-    'linkimagefield_widget' => array(
-      'label' => t('Link Image'),
-      'field types' => array('linkimagefield'),
-      'settings' => array(
-        'progress_indicator' => 'throbber',
-        'preview_image_style' => 'thumbnail',
-      ),
-      'behaviors' => array(
-        'multiple values' => FIELD_BEHAVIOR_CUSTOM,
-        'default value' => FIELD_BEHAVIOR_NONE,
-      ),
-    ),
-  );
-}
-
-/**
- * Implements hook_field_widget_settings_form().
- */
-function linkimagefield_field_widget_settings_form($field, $instance) {
-  return image_field_widget_settings_form($field, $instance);
-}
-
-/**
- * Implements hook_field_widget_form().
- */
-function linkimagefield_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
-  $elements = image_field_widget_form($form, $form_state, $field, $instance, $langcode, $items, $delta, $element);
-  foreach (element_children($elements) as $delta) {
-    $elements[$delta]['#process'][] = 'linkimagefield_widget_process';
-  }
-  return $elements;
-}
-
-/**
- * Element #process callback function.
- *
- * @param array $element
- * @param array $edit
- * @param arrayreference $form_state
- * @param array $form
- * @return array
- */
-function linkimagefield_widget_process($element, &$form_state, $form) {
-
-  $item = $element['#value'];
-  $item['fid'] = $element['fid']['#value'];
-
-  $instance = field_widget_instance($element, $form_state);
-
-  $settings = $instance['settings'];
-  $widget_settings = $instance['widget']['settings'];
-
-  $element['url'] = array(
-    '#title' => t('Link URL'),
-    '#type' => 'textfield',
-    '#default_value' => isset($item['url']) ? $item['url'] : $settings['url_settings']['url'],
-    '#description' => t('This URL will be loaded when the image is clicked'),
-    '#weight' => -4,
-    '#access' => (bool) $item['fid'],
-  );
-  $element['rel'] = array(
-    '#title' => t('Link Rel'),
-    '#type' => 'textfield',
-    '#default_value' => isset($item['rel']) ? $item['rel'] : '',
-    '#description' => t('Add rel attributes for bots, lightbox galleries, etc...'),
-    '#maxlength' => variable_get('image_longdesc_length', 500),
-    '#weight' => -4,
-    '#access' => (bool) $item['fid'] && $settings['url_settings']['rel_field'],
-  );
-  $element['class'] = array(
-    '#title' => t('Link Class'),
-    '#type' => 'textfield',
-    '#default_value' => isset($item['class']) ? $item['class'] : '',
-    '#description' => t('Add classes for theming, colorboxes, etc...'),
-    '#maxlength' => variable_get('image_longdesc_length', 500),
-    '#weight' => -4,
-    '#access' => (bool) $item['fid'] && $settings['url_settings']['class_field'],
-  );
-  $custom_target = $settings['url_settings']['custom_target'];
-  $options = array('default' => t('Use Default') . ' (' . $settings['url_settings']['target'] . ')') + _linkimagefield_widget_url_target_options();
-  $element['target'] = array(
-    '#title' => t('Link Target'),
-    '#type' => $custom_target ? 'select' : 'value',
-    '#options' => $custom_target ? $options : NULL,
-    '#default_value' => $custom_target && isset($item['target']) ? $item['target'] : $settings['url_settings']['target'],
-    '#description'   => t('Window/Frame Target for the URL'),
-    '#weight' => -4,
-    '#access' => (bool) $item['fid'] && $custom_target,
-  );
-  $element['longdesc'] = array(
-    '#title' => t('Image Longdesc'),
-    '#type' => 'textfield',
-    '#default_value' => isset($item['longdesc']) ? $item['longdesc'] : '',
-    '#description' => t('The longdesc is used to provide a link to a long description of the image.'),
-    '#maxlength' => variable_get('image_longdesc_length', 500),
-    '#weight' => -1,
-    '#access' => (bool) $item['fid'] && $settings['longdesc_field'],
-  );
-  return $element;
-}
-
-/**
- * Implements hook_field_formatter_info().
- */
-function linkimagefield_field_formatter_info() {
-  $formatters = array(
-    'linkimagefield' => array(
-      'label' => t('Link Image'),
-      'field types' => array('linkimagefield'),
-      'settings' => array('image_style' => '', 'image_link' => ''),
-    ),
-  );
-  return $formatters;
-}
-
-/**
- * Implements hook_field_formatter_settings_form().
- */
-function linkimagefield_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
-  $element = image_field_formatter_settings_form($field, $instance, $view_mode, $form, $form_state);
-  unset($element['image_link']);
-  return $element;
-}
-
-/**
- * Implements hook_field_formatter_settings_summary().
- */
-function linkimagefield_field_formatter_settings_summary($field, $instance, $view_mode) {
-  $display = $instance['display'][$view_mode];
-  $settings = $display['settings'];
-
-  $summary = array();
-
-  $image_styles = image_style_options(FALSE);
-  // Unset possible 'No defined styles' option.
-  unset($image_styles['']);
-  // Styles could be lost because of enabled/disabled modules that defines
-  // their styles in code.
-  if (isset($image_styles[$settings['image_style']])) {
-    $summary[] = t('Image style: @style', array('@style' => $image_styles[$settings['image_style']]));
-  }
-  else {
-    $summary[] = t('Original image');
-  }
-  return image_field_formatter_settings_summary($field, $instance, $view_mode);
-}
-
-/**
- * Implements hook_field_formatter_view().
- */
-function linkimagefield_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
-  $element = array();
-
-  foreach ($items as $delta => $item) {
-    // Set default values for empty elements.
-    _linkimagefield_format_set_attribute('url', $item, $instance);
-    _linkimagefield_format_set_attribute('alt', $item, $instance);
-    _linkimagefield_format_set_attribute('title', $item, $instance);
-    _linkimagefield_format_set_attribute('target', $item, $instance);
-
-    $element[$delta] = array(
-      '#theme' => 'linkimage_formatter',
-      '#item' => $item,
-      '#image_style' => $display['settings']['image_style'],
-    );
-  }
-
-  return $element;
-}
-
-/**
  * Implements hook_theme().
  */
 function linkimagefield_theme() {
   return array(
     'linkimage_formatter' => array(
-      'variables' => array('item' => NULL, 'path' => NULL, 'image_style' => NULL),
+      'template' => 'linkimage_formatter',
+      'render element' => 'element',
     ),
   );
 }
 
 /**
- * Returns HTML for an image field formatter.
+ * Prepares variables for linkimagefield formatter template.
  *
  * @param $variables
  *   An associative array containing:
- *   - item: An array of image data.
+ *   - element: An array of elements to display in formatter.
  *   - image_style: An optional image style.
- *   - path: An array containing the link 'path' and link 'options'.
+ *   - item_attributes: An array of image attributes.
  *
  * @ingroup themeable
  */
-function theme_linkimage_formatter($variables) {
-  $item = $variables['item'];
-
-  $image = array(
-    'path' => $item['uri'],
-    'alt' => $item['alt'],
-  );
-  // Gets image height and width attributes.
-  if (isset($item['width']) && isset($item['height'])) {
-    $image['width'] = $item['width'];
-    $image['height'] = $item['height'];
-  }
-  // Gets image 'longdesc' attribute.
-  if (drupal_strlen($item['longdesc']) > 0) {
-    $image['longdesc'] = $item['longdesc'];
-  }
-  // Gets anchor 'title' attribute.
-  if (drupal_strlen($item['title']) > 0) {
-    $image['title'] = $item['title'];
+function template_preprocess_linkimage_formatter(&$variables) {
+  $element = $variables['element'];
+  if ($element['#image_style']) {
+    $image = array(
+      '#theme' => 'image_style',
+      '#style_name' => $element['#image_style'],
+    );
   }
-  // Gets anchor 'rel' attribute.
-  if (drupal_strlen($item['rel']) > 0) {
-    $image['rel'] = $item['rel'];
+  else {
+    $image = array(
+      '#theme' => 'image',
+    );
   }
-  // Gets anchor 'class' attribute.
-  if (drupal_strlen($item['class']) > 0) {
-    $image['class'] = $item['class'];
+  $image['#attributes'] = $element['#item_attributes'];
+
+  $item = $element['#item'];
+
+  // Do not output an empty 'title' attribute.
+  if (drupal_strlen($item->title) != 0) {
+    $image['#title'] = $item->title;
   }
 
-  if ($variables['image_style']) {
-    $image['style_name'] = $variables['image_style'];
-    $output = theme('image_style', $image);
+  if (($entity = $item->entity) && empty($item->uri)) {
+    $image['#uri'] = $entity->getFileUri();
   }
   else {
-    $output = theme('image', $image);
+    $image['#uri'] = $item->uri;
   }
 
-  // Themes attributes for the anchor tag
-  if ($item['url']) {
-    $options = array(
-      'html' => TRUE,
-      'attributes' => array(
-        'title' => $item['title'],
-        'target' => $item['target'],
-        'rel' => $item['rel'],
-        'class' => $item['class'],
-      ),
-    );
-    $output = l($output, $item['url'], $options);
+  foreach (array('width', 'height', 'alt') as $key) {
+    $image["#$key"] = $item->$key;
   }
-  return $output;
+
+  $variables['image'] = drupal_render($image);
+  $variables['attributes'] = array(
+    'title' => $item->title,
+    'target' => $item->target,
+    'rel' => $item->rel,
+    'class' => $item->class,
+  );
+  $variables['url'] = $item->url;
 }
 
 /**
- * the list of URL frame targets
+ * The list of URL frame targets.
  *
  * @return array
  */
@@ -432,20 +84,3 @@ function _linkimagefield_widget_url_target_options() {
     '_top' => t('Top Frame (_top)'),
   );
 }
-
-/**
- * Determine whether an attribute for the link should be the default or the custom.
- *
- * Works for a url, alt or title attribute.
- *
- * @param string $attr
- * @param array $item
- * @param array $instance
- */
-function _linkimagefield_format_set_attribute($attr, &$item, $instance) {
-  $default_value = (!empty($instance['settings'][$attr]) ? $instance['settings'][$attr] : !empty($instance['settings']['url_settings'][$attr]) ? $instance['settings']['url_settings'][$attr] : '');
-
-  if (empty($item[$attr]) && !empty($default_value)) {
-    $item[$attr] = $default_value;
-  }
-}
diff --git a/templates/linkimage_formatter.html.twig b/templates/linkimage_formatter.html.twig
new file mode 100644
index 0000000..98051f1
--- /dev/null
+++ b/templates/linkimage_formatter.html.twig
@@ -0,0 +1,20 @@
+{#
+/**
+ * @file
+ * Default theme implementation to display a LinkImageField.
+ *
+ * Available variables:
+ * - image: Rendered image.
+ * - url: href option of link.
+ * - attributes: An array of link attributes.
+ *
+ * @see template_preprocess_linkimage_formatter()
+ *
+ * @ingroup themeable
+ */
+#}
+{% if url %}
+  <a href="{{ url }}"{{ attributes }}>{{ image }}</a>
+{% else %}
+  {{ image }}
+{% endif %}
\ No newline at end of file
