d i f f   - - g i t   a / n o d e _ r e f e r e n c e / n o d e _ r e f e r e n c e . m o d u l e   b / n o d e _ r e f e r e n c e / n o d e _ r e f e r e n c e . m o d u l e 
 i n d e x   1 4 1 d e 4 2 . . f 8 4 2 0 4 0   1 0 0 6 4 4 
 - - -   a / n o d e _ r e f e r e n c e / n o d e _ r e f e r e n c e . m o d u l e 
 + + +   b / n o d e _ r e f e r e n c e / n o d e _ r e f e r e n c e . m o d u l e 
 @ @   - 6 9 , 2 1   + 6 9 , 1 3 4   @ @   f u n c t i o n   n o d e _ r e f e r e n c e _ f i e l d _ s c h e m a ( $ f i e l d )   { 
   f u n c t i o n   n o d e _ r e f e r e n c e _ f i e l d _ s e t t i n g s _ f o r m ( $ f i e l d ,   $ i n s t a n c e ,   $ h a s _ d a t a )   { 
       $ s e t t i n g s   =   $ f i e l d [ ' s e t t i n g s ' ] ; 
   
 -     $ f o r m   =   a r r a y ( ) ; 
 -     $ f o r m [ ' r e f e r e n c e a b l e _ t y p e s ' ]   =   a r r a y ( 
 -         ' # t y p e '                     = >   ' c h e c k b o x e s ' , 
 -         ' # t i t l e '                   = >   t ( ' C o n t e n t   t y p e s   t h a t   c a n   b e   r e f e r e n c e d ' ) , 
 -         ' # m u l t i p l e '             = >   T R U E , 
 -         ' # d e f a u l t _ v a l u e '   = >   i s _ a r r a y ( $ s e t t i n g s [ ' r e f e r e n c e a b l e _ t y p e s ' ] ) 
 -             ?   $ s e t t i n g s [ ' r e f e r e n c e a b l e _ t y p e s ' ] 
 -             :   a r r a y ( ) , 
 -         ' # o p t i o n s '               = >   a r r a y _ m a p ( ' c h e c k _ p l a i n ' ,   n o d e _ t y p e _ g e t _ n a m e s ( ) ) , 
 -         ' # d i s a b l e d '             = >   $ h a s _ d a t a , 
 +     $ f o r m   =   a r r a y ( 
 +         ' r e f e r e n c e a b l e _ t y p e s '   = >   a r r a y ( 
 +             ' # t y p e '   = >   ' i t e m ' , 
 +             ' # t r e e '   = >   T R U E , 
 +             ' # t i t l e '   = >   t ( ' C o n t e n t   t y p e s   t h a t   c a n   b e   r e f e r e n c e d ' ) , 
 +         ) , 
       ) ; 
 + 
 +     / /   G e t   t h e   c u r r e n t l y   r e f e r e n c e d   t y p e s .   T h i s   w i l l   b e   a n   a r r a y   ( s t r i n g   = > 
 +     / /   T R U E )   w h e n   t h e   S Q L   s t o r a g e   m o d u l e   i s   u s e d .   W h e n   a n o t h e r   s t o r a g e 
 +     / /   m o d u l e   i s   u s e d ,   t h e   r e t u r n   v a l u e   w i l l   b e   N U L L . 
 +     $ r e f e r e n c e d _ t y p e s   =   _ n o d e _ r e f e r e n c e _ r e t r i e v e _ r e f e r e n c e d _ t y p e s ( $ f i e l d ) ; 
 + 
 +     $ n o d e _ t y p e _ n a m e s   =   n o d e _ t y p e _ g e t _ n a m e s ( ) ; 
 +     n a t c a s e s o r t ( $ n o d e _ t y p e _ n a m e s ) ; 
 +     f o r e a c h   ( $ n o d e _ t y p e _ n a m e s   a s   $ t y p e   = >   $ l a b e l )   { 
 +         $ i s _ s e l e c t e d   =   i s _ s t r i n g ( $ s e t t i n g s [ ' r e f e r e n c e a b l e _ t y p e s ' ] [ $ t y p e ] )   & &   $ s e t t i n g s [ ' r e f e r e n c e a b l e _ t y p e s ' ] [ $ t y p e ]   = =   $ t y p e ; 
 + 
 +         i f   ( $ h a s _ d a t a )   { 
 +             i f   ( i s s e t ( $ r e f e r e n c e d _ t y p e s ) )   { 
 +                 / /   D a t a   i s   p r e s e n t   a n d   i t   i s   k n o w n   w h i c h   t y p e s   a c t u a l l y   h a v e 
 +                 / /   r e f e r e n c e s   t o   t h e m .   D i s a b l e   d e s e l e c t i o n   o f   o n l y   t h e s e   c u r r e n t l y 
 +                 / /   r e f e r e n c e d   t y p e s . 
 +                 $ i s _ d i s a b l e d   =   ( i s s e t ( $ r e f e r e n c e d _ t y p e s [ $ t y p e ] )   & &   $ r e f e r e n c e d _ t y p e s [ $ t y p e ] )   ?   T R U E :   F A L S E ; 
 +             } 
 +             e l s e   { 
 +                 / /   D a t a   i s   p r e s e n t   b u t   i t   i s   n o t   k n o w n   w h i c h   t y p e s   a c t u a l l y   h a v e 
 +                 / /   r e f e r e n c e s   t o   t h e m .   D i s a b l e   d e s l e c t i o n   o f   a l l   t y p e s   t h a t   a r e 
 +                 / /   c u r r e n t l y   s e l e c t e d   a s   r e f e r e n c e a b l e . 
 +                 $ i s _ d i s a b l e d   =   $ i s _ s e l e c t e d ; 
 +             } 
 +         } 
 +         e l s e   { 
 +             / /   N o   d a t a   f o r   t h i s   r e f e r e n c e   f i e l d   a t   a l l .   A l l o w   d e s e l e c t i o n   o f   a l l 
 +             / /   t y p e s . 
 +             $ i s _ d i s a b l e d   =   F A L S E ; 
 +         } 
 + 
 +         $ f o r m [ ' r e f e r e n c e a b l e _ t y p e s ' ] [ $ t y p e ]   =   a r r a y ( 
 +             ' # t y p e '                     = >   ' c h e c k b o x ' , 
 +             ' # t i t l e '                   = >   c h e c k _ p l a i n ( $ l a b e l ) , 
 +             ' # d e f a u l t _ v a l u e '   = >   $ i s _ s e l e c t e d , 
 +             ' # r e t u r n _ v a l u e '     = >   $ t y p e , 
 +             ' # d i s a b l e d '             = >   $ i s _ d i s a b l e d , 
 +             ' # e l e m e n t _ v a l i d a t e '   = >   a r r a y ( ' n o d e _ r e f e r e n c e _ f i e l d _ s e t t i n g s _ r e f e r e n c e a b l e _ t y p e _ v a l i d a t e ' ) , 
 +         ) ; 
 +     } 
 +     
       r e t u r n   $ f o r m ; 
   } 
   
   / * * 
 +   *   V a l i d a t e   t h e   t y p e   s e l e c t i o n   c h e c k b o x e s .   T h i s   f u n c t i o n   e n s u r e s   t h a t   t y p e s 
 +   *   t h a t   t h e   u s e r   c a n n o t   d e s e l e c t   w o n ' t   b e   d e s e l e c t e d . 
 +   * / 
 + f u n c t i o n   n o d e _ r e f e r e n c e _ f i e l d _ s e t t i n g s _ r e f e r e n c e a b l e _ t y p e _ v a l i d a t e ( $ e l e m e n t ,   & $ f o r m _ s t a t e )   { 
 +         / /   I f   t h e   c h e c k b o x   i s   d i s a b l e d   ( a n d   t h e r e f o r e   c h e c k e d ) ,   e i t h e r : 
 +         / /   -   t h e   S Q L   s t o r a g e   m o d u l e   i s   u s e d   a n d   t h e   t y p e   i s   a c t u a l l y   r e f e r e n c e d   i n 
 +         / /       t h e   d a t a b a s e ,   o r 
 +         / /   -   a n o t h e r   s t o r a g e   m o d u l e   i s   u s e d   a n d   t h e   t y p e   w a s   p r e v i o u s l y   m a r k e d   a s 
 +         / /       r e f e r e n c e a b l e   b y   t h e   u s e r . 
 +         / / 
 +         / /   I n   b o t h   c a s e s   d o   n o t   a l l o w   t h e   u s e r   t o   d e s e l e c t   t h e   t y p e . 
 +         i f   ( $ e l e m e n t [ ' # d i s a b l e d ' ] )   { 
 +             f o r m _ s e t _ v a l u e ( $ e l e m e n t ,   $ e l e m e n t [ ' # r e t u r n _ v a l u e ' ] ,   $ f o r m _ s t a t e ) ; 
 +         } 
 + } 
 + 
 + / * * 
 +   *   R e t r i e v e   t h e   l i s t   o f   t y p e s   t h a t   a r e   a c t u a l l y   r e f e r e n c e d   b y   t h e   d a t a   o f   t h i s 
 +   *   f i e l d .   I f   t h e   S Q L   s t o r a g e   m o d u l e   i s   u s e d   i t   i s   p o s s i b l e   t o   b e   m o r e   s p e c i f i c 
 +   *   a b o u t   t h e   d a t a   o f   t h i s   f i e l d :   i n s t e a d   o f   j u s t   i n d i c a t i n g   t h a t   d a t a   i s 
 +   *   p r e s e n t ,   t h e   a c t u a l   t y p e s   r e f e r e n c e d   b y   t h i s   f i e l d   c a n   b e   r e t r i e v e d .   T h i s 
 +   *   i n f o r m a t i o n   c a n   b e   u s e d   t o   a l l o w   d e s e l e c t i o n   o f   r e f e r e n c e a b l e   t y p e s   f o r 
 +   *   w h i c h   n o   r e f e r e n c e s   a r e   p r e s e n t   i n   t h e   d a t a b a s e . 
 +   *   < p > 
 +   *   O n l y   t y p e s   t h a t   a r e   r e f e r e n c e d   b y   t h e   c u r r e n t   r e v i s i o n   o f   n o d e s   a r e 
 +   *   r e t u r n e d .   T h i s   h a s   t w o   c o n s e q u e n c e s : 
 +   *   < u l > 
 +   *   < l i > I t   w i l l   b e   p o s s i b l e   t o   d e s e l e c t   t y p e s   w h i c h   h a d   r e f e r e n c e s   i n   t h e   p a s t 
 +   *   b u t   d o n ' t   h a v e   r e f e r e n c e s   n o w .   T h i s   a l l o w s   y o u   t o   d i s a l l o w   t h e   s e l e c t i o n   o f 
 +   *   n o d e s   o f   t h e s e   t y p e s   f o r   r e f e r e n c e s . < / l i > 
 +   *   < l i > I f   a   r e v i s i o n   r e f e r e n c i n g   a   t y p e   w h i c h   i s   n o   l o n g e r   s e l e c t e d   i s 
 +   *   r e s t o r e d ,   y o u   h a v e   t o   c h o o s e   a   n o d e   w i t h   o n e   o f   t h e   c u r r e n t l y   r e f e r e n c e a b l e 
 +   *   t y p e s   w h e n   y o u   e d i t   t h e   r e s t o r e d   n o d e .   Y o u   w o n ' t   b e   a b l e   t o   k e e p   t h e   o l d 
 +   *   r e f e r e n c e   b e c a u s e   i t s   t y p e   i s   n o   l o n g e r   a l l o w e d . < / l i > 
 +   *   < / u l > 
 +   *   T h i s   f u n c t i o n   c a n n o t   h a n d l e   o t h e r   s t o r a g e   m o d u l e s   t h a n   t h e   S Q L   s t o r a g e 
 +   *   m o d u l e   a n d   w i l l   r e t u r n   N U L L   t o   i n d i c a t e   t h i s .   T h i s   a l l o w s   t h e   c a l l e r   t o 
 +   *   d i s t i n g u i s h   b e t w e e n   n o t   b e i n g   a b l e   t o   d e t e r m i n e   w h i c h   t y p e s   a r e   a c t u a l l y 
 +   *   r e f e r e n c e d   ( N U L L ) ,   a n d   n o   t y p e s   a c t u a l l y   b e i n g   r e f e r e n c e d   ( e m p t y   a r r a y ) . 
 +   * 
 +   *   @ p a r a m   F i e l d   $ f i e l d 
 +   *                 T h e   f i e l d   f o r   w h i c h   t o   r e t r i e v e   t h e   a c t u a l l y   r e f e r e n c e d   t y p e s . 
 +   *   @ r e t u r n   A r r a y 
 +   *                   A n   a r r a y   ( s t r i n g   = >   T R U E )   c o n t a i n i n g   t h e   I D s   o f   t y p e s   t h a t   a r e 
 +   *                   a c t u a l l y   r e f e r e n c e d   i n   t h e   d a t a b a s e   w h e n   t h e   S Q L   s t o r a g e   m o d u l e   i s 
 +   *                   u s e d ,   o r   N U L L   w h e n   t h e   S Q L   s t o r a g e   m o d u l e   i s   n o t   u s e d 
 +   * / 
 + f u n c t i o n   _ n o d e _ r e f e r e n c e _ r e t r i e v e _ r e f e r e n c e d _ t y p e s ( $ f i e l d )   { 
 +     $ r e f e r e n c e d _ t y p e s   =   N U L L ; 
 + 
 +     $ i s _ f i e l d _ s q l _ s t o r a g e   =   $ f i e l d [ ' s t o r a g e ' ] [ ' t y p e ' ]   = =   ' f i e l d _ s q l _ s t o r a g e ' ; 
 +     i f   ( $ i s _ f i e l d _ s q l _ s t o r a g e )   { 
 +         $ r e f e r e n c e d _ t y p e s   =   a r r a y ( ) ; 
 + 
 +         $ c u r r e n t _ d a t a _ d e t a i l s   =   $ f i e l d [ ' s t o r a g e ' ] [ ' d e t a i l s ' ] [ ' s q l ' ] [ ' F I E L D _ L O A D _ C U R R E N T ' ] ; 
 +         $ t a b l e _ d e f i n i t i o n   =   a r r a y _ k e y s ( $ c u r r e n t _ d a t a _ d e t a i l s ) ; 
 +         $ t a b l e _ n a m e   =   $ t a b l e _ d e f i n i t i o n [ 0 ] ; 
 +         $ n i d _ c o l u m n _ n a m e   =   $ c u r r e n t _ d a t a _ d e t a i l s [ $ t a b l e _ n a m e ] [ ' n i d ' ] ; 
 + 
 +         $ r e f e r e n c e d _ t y p e s _ q u e r y   =   d b _ s e l e c t ( $ t a b l e _ n a m e ,   ' f d ' ) ; 
 +         $ r e f e r e n c e d _ t y p e s _ q u e r y - > l e f t J o i n ( ' n o d e ' ,   ' n ' ,   ' f d . '   .   $ n i d _ c o l u m n _ n a m e   .   '   =   % a l i a s . n i d ' ) ; 
 +         $ r e f e r e n c e d _ t y p e s _ q u e r y - > a d d F i e l d ( ' n ' ,   ' t y p e ' ,   ' r t ' ) ; 
 +         $ r e f e r e n c e d _ t y p e s _ q u e r y - > d i s t i n c t ( ) ; 
 +         $ r e f e r e n c e d _ t y p e s _ r e s u l t   =   $ r e f e r e n c e d _ t y p e s _ q u e r y - > e x e c u t e ( ) ; 
 + 
 +         $ r o w   =   $ r e f e r e n c e d _ t y p e s _ r e s u l t - > f e t c h A s s o c ( ) ; 
 +         w h i l e   ( $ r o w )   { 
 +             $ r e f e r e n c e d _ t y p e s [ $ r o w [ ' r t ' ] ]   =   T R U E ; 
 +             $ r o w   =   $ r e f e r e n c e d _ t y p e s _ r e s u l t - > f e t c h A s s o c ( ) ; 
 +         } 
 +     } 
 + 
 +     r e t u r n   $ r e f e r e n c e d _ t y p e s ; 
 + } 
 + 
 + / * * 
     *   I m p l e m e n t s   h o o k _ f i e l d _ v a l i d a t e ( ) . 
     * 
     *   P o s s i b l e   e r r o r   c o d e s : 
 