From 396df8c09d35884a9fc9845d2b21eec40e0fba7d Mon Sep 17 00:00:00 2001
From: "Frederic G. MARAND" <fgm@osinet.fr>
Date: Thu, 21 Mar 2013 17:05:10 +0100
Subject: [PATCH 6/6] Switch from classloader to xautoload for loading, as it
 seems more resilient.

- declare a common field interface, which was not possible with classloader.
---
 classified.info                          |  2 +-
 lib/Drupal/classified/CategoryField.php  |  2 +-
 lib/Drupal/classified/ExpiresField.php   |  2 +-
 lib/Drupal/classified/FieldInterface.php | 14 ++++++++++++++
 4 files changed, 17 insertions(+), 3 deletions(-)
 create mode 100644 lib/Drupal/classified/FieldInterface.php

diff --git a/classified.info b/classified.info
index 169a22a..433cd26 100644
--- a/classified.info
+++ b/classified.info
@@ -3,7 +3,7 @@ description = "A classified ads service"
 package = Classified
 configure = admin/config/content/classified
 
-dependencies[] = classloader
+dependencies[] = xautoload
 dependencies[] = field
 dependencies[] = taxonomy
 
diff --git a/lib/Drupal/classified/CategoryField.php b/lib/Drupal/classified/CategoryField.php
index 57840df..ccf9549 100644
--- a/lib/Drupal/classified/CategoryField.php
+++ b/lib/Drupal/classified/CategoryField.php
@@ -14,7 +14,7 @@
 namespace Drupal\classified;
 
 
-class CategoryField {
+class CategoryField implements FieldInterface {
 
   /**
    * hook_field_formatter_info() delegated implementation.
diff --git a/lib/Drupal/classified/ExpiresField.php b/lib/Drupal/classified/ExpiresField.php
index fe87f04..1ff08c4 100644
--- a/lib/Drupal/classified/ExpiresField.php
+++ b/lib/Drupal/classified/ExpiresField.php
@@ -16,7 +16,7 @@ namespace Drupal\classified;
 /**
  * This field stores both an expiration type and and a manual expiration date.
  */
-class ExpiresField {
+class ExpiresField implements FieldInterface {
   const TYPE = 'classified_expires';
 
   public static function attachPresave($entity_type, $entity) {
diff --git a/lib/Drupal/classified/FieldInterface.php b/lib/Drupal/classified/FieldInterface.php
new file mode 100644
index 0000000..a12acc0
--- /dev/null
+++ b/lib/Drupal/classified/FieldInterface.php
@@ -0,0 +1,14 @@
+<?php
+namespace Drupal\classified;
+
+interface FieldInterface {
+  /**
+   * hook_field_formatter_info() delegated implementation.
+   */
+  public static function formatterInfo();
+
+  /**
+   * hook_field_formatter_view() delegated implementation.
+   */
+  public static function formatterView($entity_type, $entity, $field, $instance, $langcode, $items, $display);
+}
-- 
2.9.2

