/**
  * tl_content, tl_module and tl_form_field DCA onload callback
  *
  * Reloads config and creates the DCA fields
  *
  * @param  \DataContainer $dc Data container
  * @return void
  */
 public function onloadCallback($dc)
 {
     if (\Input::get('act') === 'create') {
         return;
     }
     if (\Input::get('act') === 'edit') {
         $this->reloadConfig();
     }
     if ($dc->table === 'tl_content' && class_exists('CeAccess')) {
         $ceAccess = new \CeAccess();
         $ceAccess->filterContentElements($dc);
     }
     if (\Input::get('act') === 'editAll') {
         return $this->createDcaMultiEdit($dc);
     }
     $type = $this->getDcaFieldValue($dc, 'type');
     if (!$type || substr($type, 0, 5) !== 'rsce_') {
         return;
     }
     $data = $this->getDcaFieldValue($dc, 'rsce_data', true);
     if ($data && substr($data, 0, 1) === '{') {
         $this->data = json_decode($data, true);
     }
     $createFromPost = \Input::post('FORM_SUBMIT') === $dc->table;
     if (\Input::get('field') && substr(\Input::get('field'), 0, 11) === 'rsce_field_') {
         // Ensures that the fileTree oder pageTree field exists
         $this->createDca($dc, $type, $createFromPost, \Input::get('field'));
     } else {
         if (\Input::post('name') && substr(\Input::post('name'), 0, 11) === 'rsce_field_') {
             // Ensures that the fileTree oder pageTree field exists
             $this->createDca($dc, $type, $createFromPost, \Input::post('name'));
         } else {
             $this->createDca($dc, $type, $createFromPost);
         }
     }
 }
 /**
  * Invert field logic for given table (tl_user or tl_user_group)
  * @param   string
  */
 private function invertElements($strTable)
 {
     if ($this->Database->fieldExists('contentelements', $strTable) && !$this->Database->fieldExists('elements', $strTable)) {
         // Add the new field to the database table
         $this->Database->query("ALTER TABLE {$strTable} ADD COLUMN elements blob NULL");
         $objResult = $this->Database->execute("SELECT id, contentelements FROM {$strTable} WHERE contentelements!=''");
         while ($objResult->next()) {
             $arrElements = deserialize($objResult->contentelements);
             if (!empty($arrElements) && is_array($arrElements)) {
                 $arrElements = array_diff(CeAccess::getContentElements(), $arrElements);
                 $this->Database->prepare("UPDATE {$strTable} SET elements=? WHERE id=?")->execute(serialize($arrElements), $objResult->id);
             }
         }
         // Delete old field to make sure the runonce is not executed again
         $this->Database->execute("ALTER TABLE {$strTable} DROP contentelements");
         $this->log('Inverted access logic for content elements in ' . $strTable, __METHOD__, TL_ACCESS);
     }
 }