AnsweredAssumed Answered

conditional viewdefs

Question asked by community-support on Jan 13, 2014
Latest reply on Jan 13, 2014 by community-support

   I found this link

   The theory is to have a selectable editviewdef.php.  For instance editviewdefs.php and closededitviewdefs.php.  My immediate need is to conditionally set a parent flex field to readonly.  But this described method suggests a whole lot more possibilities for future requirements.

   The gist is that the CustomEditView.php preDisplay call for a conditional view:

       public function preDisplay() {

         $bean = $this->bean;

         $isClosed = $bean->sent;

         if ($isClosed==1) {

             $metadataFile = 'custom/modules/[MODULEFOLDER]/metadata/closededitviewdefs.php';

             $this->ev = $this->getEditView();

             $this->ev->view = 'ClosedEditView';

         } else {

             $metadataFile = 'custom/modules/[MODULEFOLDER]/metadata/editviewdefs.php';

             $this->ev = $this->getEditView();


         $this->ev->ss =& $this->ss;

         $this->ev->setup($this->module, $this->bean, $metadataFile, get_custom_file_if_exists('include/EditView/EditView.tpl'));


after creating the two editviewdefs, do admin / repair....  but so far this isn't working for me.  Granted I am using CE 6.5.14 and this method was developed using CE 6.5.16

But I was wondering if I need to version-up or if this method needs a little more explication.  All comments, tips, ideas gratefully accepted!


(from ewpeanutty)