function Link($action = null) { if ($this->customLink) { return Director::baseURL() . 'ObjectSelectorField_Controller/find/?sourceObject=' . $this->sourceObject . '&displayField=' . $this->getDisplayFieldOptions() . '&multi=' . $this->hasMultiSortOptions(); } return parent::Link($action); }
public function Link($action = null, $id = null) { $link = parent::Link($action); if ($id) { $link = Controller::join_links($link, $id); } return $link; }
public function Link($action = null, $id = null) { $cModField = ContentModuleField::curr(); $link = ''; if ($cModField) { $link = $cModField->Link('modulefield'); $query = ''; if (stripos($link, '?') !== false) { $parts = explode('?', $link); $link = $parts[0]; $query = '?' . $parts[1]; } $link = Controller::join_links($link, $this->getName(), $action, $id, $query); } else { $link = parent::Link($action); } return $link; }
/** * Overloaded to automatically add security token. * * @param String $action * @return String */ function Link($action = null) { $form = $this->getForm(); if ($form) { $token = $form->getSecurityToken(); $parentUrlParts = parse_url(parent::Link($action)); $queryPart = isset($parentUrlParts['query']) ? '?' . $parentUrlParts['query'] : null; // Ensure that URL actions not routed through Form->httpSubmission() are protected against CSRF attacks. if ($form->securityTokenEnabled()) { $queryPart = $token->addtoUrl($queryPart); } return Controller::join_links($parentUrlParts['path'], $action, $queryPart); } else { // allow for instanciation of this FormField outside of a controller/form // context (e.g. for unit tests) return false; } }