Browse Source

pa #674: lien vers page de supports casse dans la fiche de formation. Coder review.

- implementation d'un formateur liant vers la page par support
- utilisation dans le build mode de la fiche
- ajout de PHPdoc de niveau fichier
FGM 13 years ago
parent
commit
010afd0e3d
4 changed files with 36 additions and 2 deletions
  1. 1 1
      fgcf.features.content.inc
  2. 1 1
      fgcf.import.inc
  3. 5 0
      fgcf.install
  4. 29 0
      fgcf.module

+ 1 - 1
fgcf.features.content.inc

@@ -146,7 +146,7 @@ o|Oui',
         'exclude' => 0,
       ),
       'full' => array(
-        'format' => 'link',
+        'format' => 'fgcf_support_page_link',
         'exclude' => 0,
       ),
       '4' => array(

+ 1 - 1
fgcf.import.inc

@@ -252,4 +252,4 @@ function fgcf_map_set($type, $old_id, $new_id) {
  */
 function fgcf_map_get($type, $old_id) {
   return fgcf_map_set($type, $old_id, NULL);
-}
+}

+ 5 - 0
fgcf.install

@@ -1,4 +1,9 @@
 <?php
+// $Id$
+/**
+ * @file
+ * Installer/uninstaller for FGCF module.
+ */
 
 /**
  * Implementation of hook_install().

+ 29 - 0
fgcf.module

@@ -7,6 +7,23 @@
  */
 include_once('fgcf.features.inc');
 
+/**
+ * Implementation of hook_field_formatter_info().
+ * 
+ * @return array
+ */
+ function fgcf_field_formatter_info() {
+   $ret = array(
+     'fgcf_support_page_link' => array(
+       'label'       => t('As FGCF Support Page Link'),
+       'field types' => array('content_taxonomy'),
+       'description' => t('Link to a FGCF Support page instead of a default taxonomy page.'),
+     ),
+   );
+   
+   return $ret;
+}
+ 
 /**
  * Implementation of hook_init().
  */
@@ -89,6 +106,9 @@ function fgcf_theme($existing, $type, $theme, $path) {
     'fgcf_thematiques' => array(
       'arguments' => array('terms' => array()),
     ),
+    'fgcf_formatter_fgcf_support_page_link' => array(
+      'arguments' => array('element' => NULL),
+    ),
   );
 
   return $ret;
@@ -537,3 +557,12 @@ function _fgcf_get_vocabulary_by_name($name) {
 
   return $matches[$name];
 }
+
+/**
+ * Theming functions.
+ */
+function theme_fgcf_formatter_fgcf_support_page_link($element) {
+  $term = taxonomy_get_term($element['#item']['value']);
+  $ret = l($term->name, 'fgcf/support/'. $term->tid); // can only be a tid
+  return $ret;
+}