oAttDef->GetLinkedClass(); } /** @inheritdoc * */ public function GetExtraParam(): array { $aExtraParams = array( 'target_attr' => $this->oAttDef->GetExtKeyToMe(), 'object_id' => $this->oDbObject->GetKey(), 'menu' => MetaModel::GetConfig()->Get('allow_menu_on_linkset'), 'default' => $this->GetDefault(), 'table_id' => $this->GetTableId(), 'row_actions' => $this->GetRowActions(), 'currentId' => $this->GetTableId(), ); // - Add creation in modal if the linkset is not readonly if (!$this->oAttDef->GetReadOnly()) { $aExtraParams['creation_in_modal_is_allowed'] = true; $aExtraParams['creation_in_modal_js_handler'] = 'LinkSetWorker.CreateLinkedObject("'.$this->GetTableId().'");'; } return $aExtraParams; } /** @inheritdoc * */ public function GetRowActions(): array { $aRowActions = array(); if (!$this->oAttDef->GetReadOnly()) { switch ($this->oAttDef->GetRelationType()) { case LINKSET_RELATIONTYPE_LINK: $aRowActions[] = array( 'label' => 'UI:Links:ActionRow:Detach', 'tooltip' => 'UI:Links:ActionRow:Detach+', 'icon_classes' => 'fas fa-minus', 'js_row_action' => "LinkSetWorker.DetachLinkedObject('{$this->sTargetClass}', aRowData['{$this->sTargetClass}/_key_/raw'], '{$this->oAttDef->GetExtKeyToMe()}');", 'confirmation' => [ 'message' => 'UI:Links:ActionRow:Detach:Confirmation', 'message_row_data' => "{$this->sTargetClass}/hyperlink", 'do_not_show_again_pref_key' => $this->GetDoNotShowAgainPreferenceKey(), ], ); break; case LINKSET_RELATIONTYPE_PROPERTY: $aRowActions[] = array( 'label' => 'UI:Links:ActionRow:Delete', 'tooltip' => 'UI:Links:ActionRow:Delete+', 'icon_classes' => 'fas fa-trash', 'js_row_action' => "LinkSetWorker.DeleteLinkedObject('{$this->oAttDef->GetLinkedClass()}', aRowData['{$this->oAttDef->GetLinkedClass()}/_key_/raw']);", 'confirmation' => [ 'message' => 'UI:Links:ActionRow:Delete:Confirmation', 'message_row_data' => "{$this->sTargetClass}/hyperlink", 'do_not_show_again_pref_key' => $this->GetDoNotShowAgainPreferenceKey(), ], ); break; } $aRowActions[] = array( 'tooltip' => 'UI:Links:ActionRow:Modify', 'icon_classes' => 'fas fa-pen', 'js_row_action' => "LinkSetWorker.ModifyLinkedObject('{$this->sTargetClass}', aRowData['{$this->oAttDef->GetLinkedClass()}/_key_/raw'], '{$this->GetTableId()}');", ); } return $aRowActions; } /** * GetDefault. * * @return array * @throws \ArchivedObjectException * @throws \CoreException * @throws \Exception */ private function GetDefault(): array { $aDefaults = array($this->oAttDef->GetExtKeyToMe() => $this->oDbObject->GetKey()); $oAppContext = new \ApplicationContext(); foreach ($oAppContext->GetNames() as $sKey) { if (MetaModel::IsValidAttCode($this->sObjectClass, $sKey)) { $aDefaults[$sKey] = $this->oDbObject->Get($sKey); } } return $aDefaults; } }