public function modifyFieldPalette() { if (($objFieldPalette = \HeimrichHannot\FieldPalette\FieldPaletteModel::findByPk(\Input::get('id'))) === null) { return; } $objModule = \ModuleModel::findByPk($objFieldPalette->pid); $arrDca =& $GLOBALS['TL_DCA']['tl_fieldpalette']; switch ($objModule->type) { case 'iso_direct_checkout': if (in_array('isotope_plus', \ModuleLoader::getActive())) { $arrDca['subpalettes']['iso_addSubscription'] = str_replace('iso_subscriptionArchive', 'iso_subscriptionArchive,iso_addSubscriptionCheckbox', $arrDca['subpalettes']['iso_addSubscription']); } // no break! // no break! case 'iso_checkout': if ($objFieldPalette->iso_addActivation) { $arrDca['subpalettes']['iso_addSubscription'] = str_replace('iso_addActivation', 'iso_addActivation,iso_activationNotification,iso_activationJumpTo', $arrDca['subpalettes']['iso_addSubscription']); } break; } }
public static function getParentTable($objModel, $intId) { if ($objModel->ptable == \Config::get('fieldpalette_table')) { $objModel = \HeimrichHannot\FieldPalette\FieldPaletteModel::findByPk($objModel->pid); if ($objModel === null) { throw new \Exception(sprintf($GLOBALS['TL_LANG']['ERR']['fieldPaletteNestedParentTableDoesNotExist'], $intId)); } return static::getParentTable($objModel, $intId); } return $objModel->ptable; }
public function updateParentFieldOnDelete(DataContainer $dc, $undoID) { $objCurrentRecord = \HeimrichHannot\FieldPalette\FieldPaletteModel::findByPk($dc->id); if ($objCurrentRecord === null) { return false; } $this->updateParentField($objCurrentRecord, $objCurrentRecord->id); }
protected function prepareParameter($act) { $arrParameters = array('do' => $this->do, 'ptable' => $this->ptable, 'table' => $this->table, 'act' => $this->act, 'pid' => $this->pid, 'id' => $this->id, $this->fieldpaletteKey => $this->fieldpalette, 'popup' => $this->popup); $arrAllowed = array_keys($arrParameters); switch ($act) { case 'create': $arrAllowed = array('do', 'ptable', 'table', 'act', 'pid', 'fieldpalette', 'popup', 'popupReferer'); // nested fieldpalettes if ($this->ptable == \Config::get('fieldpalette_table') && ($objModel = FieldPaletteModel::findByPk($this->pid)) !== null) { $arrParameters['table'] = FieldPalette::getParentTable($objModel, $objModel->id); } break; case 'toggle': $arrAllowed = array('do', 'table', 'state', 'tid', 'id'); $arrParameters['id'] = $this->pid; break; case 'edit': $arrAllowed = array('do', 'table', 'act', 'id', 'popup', 'popupReferer'); break; case 'copy': $arrAllowed = array('do', 'table', 'act', 'id', 'popup', 'popupReferer'); break; case 'show': $arrAllowed = array('do', 'table', 'act', 'id', 'popup', 'popupReferer'); break; case 'delete': $arrAllowed = array('do', 'table', 'act', 'id'); break; } $arrParameters = array_intersect_key($arrParameters, array_flip($arrAllowed)); return $arrParameters; }