Adding a fetch_modified_link() hook
authorRobert Sesek <rsesek@bluestatic.org>
Sun, 19 Mar 2006 19:17:18 +0000 (19:17 +0000)
committerRobert Sesek <rsesek@bluestatic.org>
Sun, 19 Mar 2006 19:17:18 +0000 (19:17 +0000)
printer_css.php

index 3fb0f1fcf97de7924e35717c20f5337dad9fed02..a166ea5fa2fe19c0e1a44ae32b521c8b8fa5d884 100644 (file)
 * This framework works in conjunction with ISSO.Printer to create a unique
 * CSS editor enviornment.
 *
+* Hooks:
+*              $this->fetch_modified_link_hook - Required hook that is run when
+*                                                                              preparing revert links for properties
+*
 * @author              Iris Studios, Inc.
 * @copyright   Copyright ©2002 - [#]year[#], Iris Studios, Inc.
 * @version             $Revision$
@@ -82,6 +86,22 @@ class Printer_CSS
                'text-decoration'       => 'text_decoration'
        );
        
+       /**
+       * Hook ran in fetch_modified_link; takes three params: $descriptor, $property, $name
+       * @var  string
+       * @access       private
+       */
+       var $fetch_modified_link_hook = ':=NO METHOD=:';
+       
+       /**
+       * Module fields
+       * @var  array
+       * @access       private
+       */
+       var $fields = array(
+               'fetch_modified_link_hook'      => array(REQ_YES,       null,   false)
+       );
+       
        // ###################################################################
        /**
        * Constructor
@@ -100,6 +120,35 @@ class Printer_CSS
                $this->__construct($registry);
        }
        
+       // ###################################################################
+       /**
+       * Sets an ISSO field
+       *
+       * @access       public
+       *
+       * @param        string  Field name
+       * @param        mixed   Value of the field
+       */
+       function set($name, $value)
+       {
+               $this->registry->do_set($name, $value, 'printer_css');
+       }
+       
+       // ###################################################################
+       /**
+       * Gets an ISSO field
+       *
+       * @access       public
+       *
+       * @param        string  Field name
+       *
+       * @return       mixed   Value of the field
+       */
+       function get($fieldname)
+       {
+               return $this->registry->do_get($fieldname, 'printer_css');
+       }
+       
        // ###################################################################
        /**
        * Adds a CSS information block to the array for later use
@@ -400,7 +449,14 @@ class Printer_CSS
                
                if ($status)
                {
-                       return '<em>' . $name . '</em>';
+                       if (is_callable($this->fetch_modified_link_hook))
+                       {
+                               return call_user_func($this->fetch_modified_link_hook, $descriptor, $property, $name);
+                       }
+                       else
+                       {
+                               trigger_error('Printer_CSS::fetch_modified_link() needs to have the fetch_modified_link_hook( $descriptor , $property , $name ) defined', E_USER_ERROR);
+                       }
                }
                else
                {