Path: blob/master/src/applications/dashboard/editor/PhabricatorDashboardEditEngine.php
13444 views
<?php12final class PhabricatorDashboardEditEngine3extends PhabricatorEditEngine {45const ENGINECONST = 'dashboard';67public function isEngineConfigurable() {8return false;9}1011public function getEngineName() {12return pht('Dashboards');13}1415public function getSummaryHeader() {16return pht('Edit Dashboards');17}1819public function getSummaryText() {20return pht('This engine is used to modify dashboards.');21}2223public function getEngineApplicationClass() {24return 'PhabricatorDashboardApplication';25}2627protected function newEditableObject() {28$viewer = $this->getViewer();29return PhabricatorDashboard::initializeNewDashboard($viewer);30}3132protected function newObjectQuery() {33return new PhabricatorDashboardQuery();34}3536protected function getObjectCreateTitleText($object) {37return pht('Create Dashboard');38}3940protected function getObjectCreateButtonText($object) {41return pht('Create Dashboard');42}4344protected function getObjectCreateCancelURI($object) {45return '/dashboard/';46}4748protected function getObjectEditTitleText($object) {49return pht('Edit Dashboard: %s', $object->getName());50}5152protected function getObjectEditShortText($object) {53return pht('Edit Dashboard');54}5556protected function getObjectCreateShortText() {57return pht('Create Dashboard');58}5960protected function getObjectName() {61return pht('Dashboard');62}6364protected function getObjectViewURI($object) {65return $object->getURI();66}6768protected function buildCustomEditFields($object) {69$layout_options = PhabricatorDashboardLayoutMode::getLayoutModeMap();7071$fields = array(72id(new PhabricatorTextEditField())73->setKey('name')74->setLabel(pht('Name'))75->setDescription(pht('Name of the dashboard.'))76->setConduitDescription(pht('Rename the dashboard.'))77->setConduitTypeDescription(pht('New dashboard name.'))78->setTransactionType(79PhabricatorDashboardNameTransaction::TRANSACTIONTYPE)80->setIsRequired(true)81->setValue($object->getName()),82id(new PhabricatorIconSetEditField())83->setKey('icon')84->setLabel(pht('Icon'))85->setTransactionType(86PhabricatorDashboardIconTransaction::TRANSACTIONTYPE)87->setIconSet(new PhabricatorDashboardIconSet())88->setDescription(pht('Dashboard icon.'))89->setConduitDescription(pht('Change the dashboard icon.'))90->setConduitTypeDescription(pht('New dashboard icon.'))91->setValue($object->getIcon()),92id(new PhabricatorSelectEditField())93->setKey('layout')94->setLabel(pht('Layout'))95->setDescription(pht('Dashboard layout mode.'))96->setConduitDescription(pht('Change the dashboard layout mode.'))97->setConduitTypeDescription(pht('New dashboard layout mode.'))98->setTransactionType(99PhabricatorDashboardLayoutTransaction::TRANSACTIONTYPE)100->setOptions($layout_options)101->setValue($object->getRawLayoutMode()),102);103104return $fields;105}106107}108109110