Example #1
0
 /**
  * Parse the template.
  *
  * @return string
  *
  * @SuppressWarnings(PHPMD.Superglobals)
  * @SuppressWarnings(PHPMD.CamelCaseVariableName)
  */
 public function generate()
 {
     $GLOBALS['TL_CSS'][] = 'system/modules/metamodels/assets/css/style.css';
     $arrModule = $GLOBALS['BE_MOD']['metamodels']['metamodels'];
     // Custom action (if key is not defined in config.php the default action will be called).
     if (\Input::get('key') && isset($arrModule[\Input::get('key')])) {
         Callbacks::call($arrModule[\Input::get('key')], $this, $arrModule);
     }
     $act = \Input::get('act');
     if (!strlen($act)) {
         $act = 'showAll';
     }
     return $this->dataContainer->getEnvironment()->getController()->handle(new Action($act));
 }
Example #2
0
 /**
  * Call the table name callback.
  *
  * @param string $strTable The current table name.
  *
  * @return string New name of current table.
  */
 protected function getTablenameCallback($strTable)
 {
     if (array_key_exists('tablename_callback', $GLOBALS['TL_DCA'][$strTable]['config']) && is_array($GLOBALS['TL_DCA'][$strTable]['config']['tablename_callback'])) {
         foreach ($GLOBALS['TL_DCA'][$strTable]['config']['tablename_callback'] as $callback) {
             $strCurrentTable = Callbacks::call($callback, $strTable, $this);
             if ($strCurrentTable != null) {
                 $strTable = $strCurrentTable;
             }
         }
     }
     return $strTable;
 }
 /**
  * Invoke the callback.
  *
  * @param AbstractEnvironmentAwareEvent $event The Event for which the callback shall be invoked.
  *
  * @return void
  */
 public function __invoke($event)
 {
     if ($this->getCallback() && $this->wantToExecute($event)) {
         Callbacks::callArgs($this->getCallback(), $this->getArgs($event));
     }
 }