Exemplo n.º 1
0
 /**
  * Generate a form and return it as string
  * 
  * @param mixed $varId A form ID or a Model object
  * 
  * @return string The form HTML markup
  */
 protected function getForm($varId)
 {
     if (is_object($varId)) {
         $objRow = $varId;
     } else {
         if ($varId == '') {
             return '';
         }
         $objRow = \FormModel::findByIdOrAlias($varId);
         if ($objRow === null) {
             return '';
         }
     }
     $objRow->typePrefix = 'ce_';
     $objRow->form = $objRow->id;
     $objElement = new \Form($objRow);
     $strBuffer = $objElement->generate();
     // HOOK: add custom logic
     if (isset($GLOBALS['TL_HOOKS']['getForm']) && is_array($GLOBALS['TL_HOOKS']['getForm'])) {
         foreach ($GLOBALS['TL_HOOKS']['getForm'] as $callback) {
             $this->import($callback[0]);
             $strBuffer = $this->{$callback}[0]->{$callback}[1]($objRow, $strBuffer);
         }
     }
     return $strBuffer;
 }
 /**
  * Generate a form and return it as string
  *
  * @param mixed  $varId     A form ID or a Model object
  * @param string $strColumn The column the form is in
  *
  * @return string The form HTML markup
  */
 public static function getForm($varId, $strColumn = 'main')
 {
     if (is_object($varId)) {
         $objRow = $varId;
     } else {
         if ($varId == '') {
             return '';
         }
         $objRow = \FormModel::findByIdOrAlias($varId);
         if ($objRow === null) {
             return '';
         }
     }
     $objRow->typePrefix = 'ce_';
     $objRow->form = $objRow->id;
     $objElement = new \Form($objRow, $strColumn);
     $strBuffer = $objElement->generate();
     // HOOK: add custom logic
     if (isset($GLOBALS['TL_HOOKS']['getForm']) && is_array($GLOBALS['TL_HOOKS']['getForm'])) {
         foreach ($GLOBALS['TL_HOOKS']['getForm'] as $callback) {
             $strBuffer = static::importStatic($callback[0])->{$callback[1]}($objRow, $strBuffer, $objElement);
         }
     }
     return $strBuffer;
 }