]> gitweb.fluxo.info Git - drupal/muamba.git/commitdiff
Adding handlers code
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 7 Oct 2011 17:14:27 +0000 (14:14 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 7 Oct 2011 17:14:27 +0000 (14:14 -0300)
muamba.module
views/muamba.handlers.inc [new file with mode: 0644]
views/muamba.views.inc [moved from muamba.views.inc with 88% similarity]

index 0cfe9772c426a3fa0601336ca1c106bbfe756dec..ccaed415cf43a6735156dea7dec688be8520ccc3 100644 (file)
@@ -271,21 +271,11 @@ function muamba_user_delete($account) {
 }
 
 /**
- * Register View API information. This is required for your module to have
- * its include files loaded; for example, when implementing
- * hook_views_default_views().
- *
- * @return
- *   An array with the following possible keys:
- *   - api:  (required) The version of the Views API the module implements.
- *   - path: (optional) If includes are stored somewhere other than within
- *       the root module directory, specify its path here.
- *   - template path: (optional) A path where the module has stored it's views template files.
- *        When you have specificed this key views automatically uses the template files for the views.
- *        You can use the same naming conventions like for normal views template files.
+ * Implementes hook_views_data()
  */
 function muamba_views_api() {
   return array(
-    'api' => 3,
+    'api'  => 3,
+    'path' => drupal_get_path('module', 'muamba') . '/views',
   );
 }
diff --git a/views/muamba.handlers.inc b/views/muamba.handlers.inc
new file mode 100644 (file)
index 0000000..9c5c6b9
--- /dev/null
@@ -0,0 +1,16 @@
+<?php
+
+/**
+ * @file
+ * Contains the muamba transaction status views field handler.
+ */
+
+class views_handler_field_muamba_status extends views_handler_field_field {
+  /**
+   * Renders the field.
+   */
+  function render($values) {
+    return $values;
+    }
+  }  
+}
similarity index 88%
rename from muamba.views.inc
rename to views/muamba.views.inc
index c1f77a05d42f08a90697e56f31004ed6484be477..831fe712de7d6692c684b55b73f811f060b64262 100644 (file)
@@ -95,7 +95,7 @@ function muamba_views_data() {
     'title' => t('Status'), 
     'help'  => t('Transaction status'), 
     'field' => array(
-      'handler'        => 'views_handler_field_numeric', 
+      'handler'        => 'views_handler_field_muamba_status', 
       'click sortable' => TRUE,
     ), 
     'filter' => array(
@@ -108,3 +108,18 @@ function muamba_views_data() {
 
   return $data;
 }
+
+/**
+ * Implements hook_views_handlers()
+ */
+function muamba_views_handlers() {
+  $common = array(
+    'parent' => 'views_handler_field',
+    'file'   => 'muamba.handlers.inc',
+  );
+  return array(
+    'handlers' => array(
+      'views_handler_field_muamba_status'  => $common,
+    ),
+  );
+}