Source of file ContentModuleTreeDropdownField.php
Size: 1,853 Bytes - Last Modified: 2021-12-23T10:59:17+00:00
/var/www/docs.ssmods.com/process/src/code/form/ContentModuleTreeDropdownField.php
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 | <?php /** * Created by JetBrains PhpStorm. * User: 7 * Date: 26/04/13 * Time: 11:15 AM * To change this template use File | Settings | File Templates. */ class ContentModuleTreeDropdownField extends TreeDropdownField { private $contentModuleFieldName = ''; private $originalFieldName = ''; protected $_idField; public function setContentModuleNames($name, $contentName, $id = null) { $this->_idField = $id; $this->setName($name); $this->originalFieldName = $name; $this->contentModuleFieldName = $contentName; } public function Link($action = null) { $cModField = ContentModuleField::curr(); $link = ''; if ($cModField) { $link = ContentModuleField::curr()->Link('modulefield'); $name = $this->contentModuleFieldName ? $this->contentModuleFieldName : $this->getName(); $query = ''; if (stripos($link, '?') !== false) { $parts = explode('?', $link); $link = $parts[0]; $query = '?' . $parts[1]; } if (($pos = stripos($name, '[')) !== false) { $name = substr($name, 0, $pos); $action = substr($this->name, $pos + 1, strlen($this->name) - 1 - ($pos + 1)) . 'Tree'; } $link = Controller::join_links($link, $name, $action, $query); } else { $link = parent::Link($action); } return $link; } public function getForm() { $cModField = ContentModuleField::curr(); if ($cModField) { return $cModField->getForm(); } return parent::getForm(); } public function getModifiedName() { return !empty($this->originalFieldName) ? $this->originalFieldName : $this->name; } } |