Differential D14398 Diff 34803 src/applications/transactions/editengine/PhabricatorApplicationEditEngine.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/editengine/PhabricatorApplicationEditEngine.php
| <?php | <?php | ||||
| /** | /** | ||||
| * @task fields Managing Fields | |||||
| * @task text Display Text | |||||
| * @task uri Managing URIs | |||||
| * @task load Creating and Loading Objects | |||||
| * @task web Responding to Web Requests | * @task web Responding to Web Requests | ||||
| * @task edit Responding to Edit Requests | |||||
| * @task http Responding to HTTP Parameter Requests | |||||
| * @task conduit Responding to Conduit Requests | * @task conduit Responding to Conduit Requests | ||||
| */ | */ | ||||
| abstract class PhabricatorApplicationEditEngine extends Phobject { | abstract class PhabricatorApplicationEditEngine extends Phobject { | ||||
| private $viewer; | private $viewer; | ||||
| private $controller; | private $controller; | ||||
| private $isCreate; | private $isCreate; | ||||
| Show All 11 Lines | final public function setController(PhabricatorController $controller) { | ||||
| $this->setViewer($controller->getViewer()); | $this->setViewer($controller->getViewer()); | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| final public function getController() { | final public function getController() { | ||||
| return $this->controller; | return $this->controller; | ||||
| } | } | ||||
| /* -( Managing Fields )---------------------------------------------------- */ | |||||
| abstract protected function buildCustomEditFields($object); | |||||
| final protected function buildEditFields($object) { | final protected function buildEditFields($object) { | ||||
| $viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
| $editor = $object->getApplicationTransactionEditor(); | $editor = $object->getApplicationTransactionEditor(); | ||||
| $types = $editor->getTransactionTypesForObject($object); | $types = $editor->getTransactionTypesForObject($object); | ||||
| $types = array_fuse($types); | $types = array_fuse($types); | ||||
| $fields = $this->buildCustomEditFields($object); | $fields = $this->buildCustomEditFields($object); | ||||
| ▲ Show 20 Lines • Show All 130 Lines • ▼ Show 20 Lines | if ($object instanceof PhabricatorSubscribableInterface) { | ||||
| ->setDatasource(new PhabricatorMetaMTAMailableDatasource()) | ->setDatasource(new PhabricatorMetaMTAMailableDatasource()) | ||||
| ->setAliases(array('subscriber', 'subscribers')) | ->setAliases(array('subscriber', 'subscribers')) | ||||
| ->setTransactionType($subscribers_type) | ->setTransactionType($subscribers_type) | ||||
| ->setValue($sub_phids); | ->setValue($sub_phids); | ||||
| $fields[] = $subscribers_field; | $fields[] = $subscribers_field; | ||||
| } | } | ||||
| } | } | ||||
| foreach ($fields as $field) { | |||||
| $field | |||||
| ->setViewer($viewer) | |||||
| ->setObject($object); | |||||
| } | |||||
| return $fields; | return $fields; | ||||
| } | } | ||||
| abstract protected function newEditableObject(); | |||||
| abstract protected function newObjectQuery(); | |||||
| abstract protected function buildCustomEditFields($object); | |||||
| /* -( Display Text )------------------------------------------------------- */ | |||||
| /** | |||||
| * @task text | |||||
| */ | |||||
| abstract protected function getObjectCreateTitleText($object); | abstract protected function getObjectCreateTitleText($object); | ||||
| /** | |||||
| * @task text | |||||
| */ | |||||
| abstract protected function getObjectEditTitleText($object); | abstract protected function getObjectEditTitleText($object); | ||||
| /** | |||||
| * @task text | |||||
| */ | |||||
| abstract protected function getObjectCreateShortText($object); | abstract protected function getObjectCreateShortText($object); | ||||
| /** | |||||
| * @task text | |||||
| */ | |||||
| abstract protected function getObjectEditShortText($object); | abstract protected function getObjectEditShortText($object); | ||||
| /** | |||||
| * @task text | |||||
| */ | |||||
| protected function getObjectCreateButtonText($object) { | |||||
| return $this->getObjectCreateTitleText($object); | |||||
| } | |||||
| /** | |||||
| * @task text | |||||
| */ | |||||
| protected function getObjectEditButtonText($object) { | |||||
| return pht('Save Changes'); | |||||
| } | |||||
| /* -( Managing URIs )------------------------------------------------------ */ | |||||
| /** | |||||
| * @task uri | |||||
| */ | |||||
| abstract protected function getObjectViewURI($object); | abstract protected function getObjectViewURI($object); | ||||
| /** | |||||
| * @task uri | |||||
| */ | |||||
| protected function getObjectEditURI($object) { | protected function getObjectEditURI($object) { | ||||
| return $this->getController()->getApplicationURI('edit/'); | return $this->getController()->getApplicationURI('edit/'); | ||||
| } | } | ||||
| /** | |||||
| * @task uri | |||||
| */ | |||||
| protected function getObjectCreateCancelURI($object) { | protected function getObjectCreateCancelURI($object) { | ||||
| return $this->getController()->getApplicationURI(); | return $this->getController()->getApplicationURI(); | ||||
| } | } | ||||
| /** | |||||
| * @task uri | |||||
| */ | |||||
| protected function getObjectEditCancelURI($object) { | protected function getObjectEditCancelURI($object) { | ||||
| return $this->getObjectViewURI($object); | return $this->getObjectViewURI($object); | ||||
| } | } | ||||
| protected function getObjectCreateButtonText($object) { | |||||
| return $this->getObjectCreateTitleText($object); | |||||
| } | |||||
| protected function getObjectEditButtonText($object) { | |||||
| return pht('Save Changes'); | |||||
| } | |||||
| /** | |||||
| * @task uri | |||||
| */ | |||||
| protected function getEditURI($object, $path = null) { | protected function getEditURI($object, $path = null) { | ||||
| $parts = array( | $parts = array( | ||||
| $this->getObjectEditURI($object), | $this->getObjectEditURI($object), | ||||
| ); | ); | ||||
| if (!$this->getIsCreate()) { | if (!$this->getIsCreate()) { | ||||
| $parts[] = $object->getID().'/'; | $parts[] = $object->getID().'/'; | ||||
| } | } | ||||
| if ($path !== null) { | if ($path !== null) { | ||||
| $parts[] = $path; | $parts[] = $path; | ||||
| } | } | ||||
| return implode('', $parts); | return implode('', $parts); | ||||
| } | } | ||||
| final protected function setIsCreate($is_create) { | |||||
| /* -( Creating and Loading Objects )--------------------------------------- */ | |||||
| /** | |||||
| * Initialize a new object for creation. | |||||
| * | |||||
| * @return object Newly initialized object. | |||||
| * @task load | |||||
| */ | |||||
| abstract protected function newEditableObject(); | |||||
| /** | |||||
| * Build an empty query for objects. | |||||
| * | |||||
| * @return PhabricatorPolicyAwareQuery Query. | |||||
| * @task load | |||||
| */ | |||||
| abstract protected function newObjectQuery(); | |||||
| /** | |||||
| * Test if this workflow is creating a new object or editing an existing one. | |||||
| * | |||||
| * @return bool True if a new object is being created. | |||||
| * @task load | |||||
| */ | |||||
| final protected function getIsCreate() { | |||||
| return $this->isCreate; | |||||
| } | |||||
| /** | |||||
| * Flag this workflow as a create or edit. | |||||
| * | |||||
| * @param bool True if this is a create workflow. | |||||
| * @return this | |||||
| * @task load | |||||
| */ | |||||
| private function setIsCreate($is_create) { | |||||
| $this->isCreate = $is_create; | $this->isCreate = $is_create; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| final protected function getIsCreate() { | |||||
| return $this->isCreate; | /** | ||||
| * Load an object by ID. | |||||
| * | |||||
| * @param int Object ID. | |||||
| * @return object|null Object, or null if no such object exists. | |||||
| * @task load | |||||
| */ | |||||
| private function newObjectFromID($id) { | |||||
| $query = $this->newObjectQuery() | |||||
| ->withIDs(array($id)); | |||||
| return $this->newObjectFromQuery($query); | |||||
| } | } | ||||
| final public function buildResponse() { | |||||
| $controller = $this->getController(); | /** | ||||
| * Load an object by PHID. | |||||
| * | |||||
| * @param phid Object PHID. | |||||
| * @return object|null Object, or null if no such object exists. | |||||
| * @task load | |||||
| */ | |||||
| private function newObjectFromPHID($phid) { | |||||
| $query = $this->newObjectQuery() | |||||
| ->withPHIDs(array($phid)); | |||||
| return $this->newObjectFromQuery($query); | |||||
| } | |||||
| /** | |||||
| * Load an object given a configured query. | |||||
| * | |||||
| * @param PhabricatorPolicyAwareQuery Configured query. | |||||
| * @return object|null Object, or null if no such object exists. | |||||
| * @task load | |||||
| */ | |||||
| private function newObjectFromQuery(PhabricatorPolicyAwareQuery $query) { | |||||
| $viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
| $request = $controller->getRequest(); | |||||
| $id = $request->getURIData('id'); | $object = $query | ||||
| if ($id) { | |||||
| $object = $this->newObjectQuery() | |||||
| ->setViewer($viewer) | ->setViewer($viewer) | ||||
| ->withIDs(array($id)) | |||||
| ->requireCapabilities( | ->requireCapabilities( | ||||
| array( | array( | ||||
| PhabricatorPolicyCapability::CAN_VIEW, | PhabricatorPolicyCapability::CAN_VIEW, | ||||
| PhabricatorPolicyCapability::CAN_EDIT, | PhabricatorPolicyCapability::CAN_EDIT, | ||||
| )) | )) | ||||
| ->executeOne(); | ->executeOne(); | ||||
| if (!$object) { | if (!$object) { | ||||
| return new Aphront404Response(); | return null; | ||||
| } | } | ||||
| $this->setIsCreate(false); | |||||
| } else { | return $object; | ||||
| $object = $this->newEditableObject(); | |||||
| $this->setIsCreate(true); | |||||
| } | } | ||||
| $fields = $this->buildEditFields($object); | |||||
| foreach ($fields as $field) { | /* -( Responding to Web Requests )----------------------------------------- */ | ||||
| $field | |||||
| ->setViewer($viewer) | |||||
| ->setObject($object); | final public function buildResponse() { | ||||
| $viewer = $this->getViewer(); | |||||
| $controller = $this->getController(); | |||||
| $request = $controller->getRequest(); | |||||
| $id = $request->getURIData('id'); | |||||
| if ($id) { | |||||
| $this->setIsCreate(false); | |||||
| $object = $this->newObjectFromID($id); | |||||
| if (!$object) { | |||||
| return new Aphront404Response(); | |||||
| } | |||||
| } else { | |||||
| $this->setIsCreate(true); | |||||
| $object = $this->newEditableObject(); | |||||
| } | } | ||||
| $action = $request->getURIData('editAction'); | $action = $request->getURIData('editAction'); | ||||
| switch ($action) { | switch ($action) { | ||||
| case 'parameters': | case 'parameters': | ||||
| return $this->buildParametersResponse($object, $fields); | return $this->buildParametersResponse($object); | ||||
| default: | |||||
| return $this->buildEditResponse($object); | |||||
| } | |||||
| } | |||||
| private function buildCrumbs($object, $final = false) { | |||||
| $controller = $this->getcontroller(); | |||||
| $crumbs = $controller->buildApplicationCrumbsForEditEngine(); | |||||
| if ($this->getIsCreate()) { | |||||
| $create_text = $this->getObjectCreateShortText($object); | |||||
| if ($final) { | |||||
| $crumbs->addTextCrumb($create_text); | |||||
| } else { | |||||
| $edit_uri = $this->getEditURI($object); | |||||
| $crumbs->addTextCrumb($create_text, $edit_uri); | |||||
| } | |||||
| } else { | |||||
| $crumbs->addTextCrumb( | |||||
| $this->getObjectEditShortText($object), | |||||
| $this->getObjectViewURI($object)); | |||||
| $edit_text = pht('Edit'); | |||||
| if ($final) { | |||||
| $crumbs->addTextCrumb($edit_text); | |||||
| } else { | |||||
| $edit_uri = $this->getEditURI($object); | |||||
| $crumbs->addTextCrumb($edit_text, $edit_uri); | |||||
| } | } | ||||
| } | |||||
| return $crumbs; | |||||
| } | |||||
| private function buildEditResponse($object) { | |||||
| $viewer = $this->getViewer(); | |||||
| $controller = $this->getController(); | |||||
| $request = $controller->getRequest(); | |||||
| $fields = $this->buildEditFields($object); | |||||
| $template = $object->getApplicationTransactionTemplate(); | |||||
| $validation_exception = null; | $validation_exception = null; | ||||
| if ($request->isFormPost()) { | if ($request->isFormPost()) { | ||||
| foreach ($fields as $field) { | foreach ($fields as $field) { | ||||
| $field->readValueFromSubmit($request); | $field->readValueFromSubmit($request); | ||||
| } | } | ||||
| $template = $object->getApplicationTransactionTemplate(); | |||||
| $xactions = array(); | $xactions = array(); | ||||
| foreach ($fields as $field) { | foreach ($fields as $field) { | ||||
| $xactions[] = $field->generateTransaction(clone $template); | $xactions[] = $field->generateTransaction(clone $template); | ||||
| } | } | ||||
| $editor = $object->getApplicationTransactionEditor() | $editor = $object->getApplicationTransactionEditor() | ||||
| ->setActor($viewer) | ->setActor($viewer) | ||||
| ->setContentSourceFromRequest($request) | ->setContentSourceFromRequest($request) | ||||
| ->setContinueOnNoEffect(true) | ->setContinueOnNoEffect(true); | ||||
| ->setContinueOnMissingFields(false); | |||||
| try { | try { | ||||
| $editor->applyTransactions($object, $xactions); | $editor->applyTransactions($object, $xactions); | ||||
| return id(new AphrontRedirectResponse()) | return id(new AphrontRedirectResponse()) | ||||
| ->setURI($this->getObjectViewURI($object)); | ->setURI($this->getObjectViewURI($object)); | ||||
| } catch (PhabricatorApplicationTransactionValidationException $ex) { | } catch (PhabricatorApplicationTransactionValidationException $ex) { | ||||
| $validation_exception = $ex; | $validation_exception = $ex; | ||||
| } | } | ||||
| } else { | } else { | ||||
| if ($this->getIsCreate()) { | if ($this->getIsCreate()) { | ||||
| foreach ($fields as $field) { | foreach ($fields as $field) { | ||||
| $field->readValueFromRequest($request); | $field->readValueFromRequest($request); | ||||
| } | } | ||||
| } else { | } else { | ||||
| foreach ($fields as $field) { | foreach ($fields as $field) { | ||||
| $field->readValueFromObject($object); | $field->readValueFromObject($object); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| $box = id(new PHUIObjectBoxView()) | $action_button = $this->buildEditFormActionButton($object); | ||||
| ->setUser($viewer); | |||||
| $crumbs = $this->buildCrumbs($object, $final = true); | |||||
| if ($this->getIsCreate()) { | if ($this->getIsCreate()) { | ||||
| $header_text = $this->getObjectCreateTitleText($object); | $header_text = $this->getObjectCreateTitleText($object); | ||||
| $cancel_uri = $this->getObjectCreateCancelURI($object); | |||||
| $submit_button = $this->getObjectCreateButtonText($object); | |||||
| } else { | } else { | ||||
| $header_text = $this->getObjectEditTitleText($object); | $header_text = $this->getObjectEditTitleText($object); | ||||
| $cancel_uri = $this->getObjectEditCancelURI($object); | |||||
| $submit_button = $this->getObjectEditButtonText($object); | |||||
| } | } | ||||
| $header = id(new PHUIHeaderView()) | $header = id(new PHUIHeaderView()) | ||||
| ->setHeader($header_text); | ->setHeader($header_text) | ||||
| ->addActionLink($action_button); | |||||
| $action_button = $this->buildEditFormActionButton($object); | |||||
| $header->addActionLink($action_button); | |||||
| $box->setHeader($header); | |||||
| $form = id(new AphrontFormView()) | $crumbs = $this->buildCrumbs($object, $final = true); | ||||
| ->setUser($viewer); | $form = $this->buildEditForm($object, $fields); | ||||
| foreach ($fields as $field) { | |||||
| $field->appendToForm($form); | |||||
| } | |||||
| $form->appendControl( | |||||
| id(new AphrontFormSubmitControl()) | |||||
| ->addCancelButton($cancel_uri) | |||||
| ->setValue($submit_button)); | |||||
| $box->appendChild($form); | |||||
| if ($validation_exception) { | $box = id(new PHUIObjectBoxView()) | ||||
| $box->setValidationException($validation_exception); | ->setUser($viewer) | ||||
| } | ->setHeader($header) | ||||
| ->setValidationException($validation_exception) | |||||
| ->appendChild($form); | |||||
| return $controller->newPage() | return $controller->newPage() | ||||
| ->setTitle($header_text) | ->setTitle($header_text) | ||||
| ->setCrumbs($crumbs) | ->setCrumbs($crumbs) | ||||
| ->appendChild($box); | ->appendChild($box); | ||||
| } | } | ||||
| private function buildParametersResponse($object, array $fields) { | private function buildEditForm($object, array $fields) { | ||||
| $controller = $this->getController(); | |||||
| $viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
| $request = $controller->getRequest(); | |||||
| $crumbs = $this->buildCrumbs($object); | |||||
| $crumbs->addTextCrumb(pht('HTTP Parameters')); | |||||
| $crumbs->setBorder(true); | |||||
| $header = id(new PHUIHeaderView()) | |||||
| ->setHeader( | |||||
| pht( | |||||
| 'HTTP Parameters: %s', | |||||
| $this->getObjectCreateShortText($object))); | |||||
| $document = id(new PHUIDocumentViewPro()) | $form = id(new AphrontFormView()) | ||||
| ->setUser($viewer) | ->setUser($viewer); | ||||
| ->setHeader($header); | |||||
| $document->appendChild( | |||||
| id(new PhabricatorApplicationEditHTTPParameterHelpView()) | |||||
| ->setUser($viewer) | |||||
| ->setFields($fields)); | |||||
| return $controller->newPage() | foreach ($fields as $field) { | ||||
| ->setTitle(pht('HTTP Parameters')) | $field->appendToForm($form); | ||||
| ->setCrumbs($crumbs) | |||||
| ->addClass('pro-white-background') | |||||
| ->appendChild($document); | |||||
| } | } | ||||
| private function buildCrumbs($object, $final = false) { | |||||
| $controller = $this->getcontroller(); | |||||
| $crumbs = $controller->buildApplicationCrumbsForEditEngine(); | |||||
| if ($this->getIsCreate()) { | if ($this->getIsCreate()) { | ||||
| $create_text = $this->getObjectCreateShortText($object); | $cancel_uri = $this->getObjectCreateCancelURI($object); | ||||
| if ($final) { | $submit_button = $this->getObjectCreateButtonText($object); | ||||
| $crumbs->addTextCrumb($create_text); | |||||
| } else { | } else { | ||||
| $edit_uri = $this->getEditURI($object); | $cancel_uri = $this->getObjectEditCancelURI($object); | ||||
| $crumbs->addTextCrumb($create_text, $edit_uri); | $submit_button = $this->getObjectEditButtonText($object); | ||||
| } | } | ||||
| } else { | |||||
| $crumbs->addTextCrumb( | |||||
| $this->getObjectEditShortText($object), | |||||
| $this->getObjectViewURI($object)); | |||||
| $edit_text = pht('Edit'); | $form->appendControl( | ||||
| if ($final) { | id(new AphrontFormSubmitControl()) | ||||
| $crumbs->addTextCrumb($edit_text); | ->addCancelButton($cancel_uri) | ||||
| } else { | ->setValue($submit_button)); | ||||
| $edit_uri = $this->getEditURI($object); | |||||
| $crumbs->addTextCrumb($edit_text, $edit_uri); | |||||
| } | |||||
| } | |||||
| return $crumbs; | return $form; | ||||
| } | } | ||||
| private function buildEditFormActionButton($object) { | private function buildEditFormActionButton($object) { | ||||
| $viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
| $action_view = id(new PhabricatorActionListView()) | $action_view = id(new PhabricatorActionListView()) | ||||
| ->setUser($viewer); | ->setUser($viewer); | ||||
| Show All 18 Lines | $actions[] = id(new PhabricatorActionView()) | ||||
| ->setName(pht('Show HTTP Parameters')) | ->setName(pht('Show HTTP Parameters')) | ||||
| ->setIcon('fa-crosshairs') | ->setIcon('fa-crosshairs') | ||||
| ->setHref($this->getEditURI($object, 'parameters/')); | ->setHref($this->getEditURI($object, 'parameters/')); | ||||
| return $actions; | return $actions; | ||||
| } | } | ||||
| /* -( Responding to HTTP Parameter Requests )------------------------------ */ | |||||
| /** | |||||
| * Respond to a request for documentation on HTTP parameters. | |||||
| * | |||||
| * @param object Editable object. | |||||
| * @return AphrontResponse Response object. | |||||
| * @task http | |||||
| */ | |||||
| private function buildParametersResponse($object) { | |||||
| $controller = $this->getController(); | |||||
| $viewer = $this->getViewer(); | |||||
| $request = $controller->getRequest(); | |||||
| $fields = $this->buildEditFields($object); | |||||
| $crumbs = $this->buildCrumbs($object); | |||||
| $crumbs->addTextCrumb(pht('HTTP Parameters')); | |||||
| $crumbs->setBorder(true); | |||||
| $header_text = pht( | |||||
| 'HTTP Parameters: %s', | |||||
| $this->getObjectCreateShortText($object)); | |||||
| $header = id(new PHUIHeaderView()) | |||||
| ->setHeader($header_text); | |||||
| $help_view = id(new PhabricatorApplicationEditHTTPParameterHelpView()) | |||||
| ->setUser($viewer) | |||||
| ->setFields($fields); | |||||
| $document = id(new PHUIDocumentViewPro()) | |||||
| ->setUser($viewer) | |||||
| ->setHeader($header) | |||||
| ->appendChild($help_view); | |||||
| return $controller->newPage() | |||||
| ->setTitle(pht('HTTP Parameters')) | |||||
| ->setCrumbs($crumbs) | |||||
| ->addClass('pro-white-background') | |||||
| ->appendChild($document); | |||||
| } | |||||
| /* -( Conduit )------------------------------------------------------------ */ | /* -( Conduit )------------------------------------------------------------ */ | ||||
| /** | /** | ||||
| * Respond to a Conduit edit request. | * Respond to a Conduit edit request. | ||||
| * | * | ||||
| * This method accepts a list of transactions to apply to an object, and | * This method accepts a list of transactions to apply to an object, and | ||||
| * either edits an existing object or creates a new one. | * either edits an existing object or creates a new one. | ||||
| * | * | ||||
| * @task conduit | * @task conduit | ||||
| */ | */ | ||||
| final public function buildConduitResponse(ConduitAPIRequest $request) { | final public function buildConduitResponse(ConduitAPIRequest $request) { | ||||
| $viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
| $phid = $request->getValue('objectPHID'); | $phid = $request->getValue('objectPHID'); | ||||
| if ($phid) { | if ($phid) { | ||||
| $object = $this->newObjectQuery() | $this->setIsCreate(false); | ||||
| ->setViewer($viewer) | $object = $this->newObjectFromPHID($phid); | ||||
| ->withPHIDs(array($phid)) | |||||
| ->requireCapabilities( | |||||
| array( | |||||
| PhabricatorPolicyCapability::CAN_VIEW, | |||||
| PhabricatorPolicyCapability::CAN_EDIT, | |||||
| )) | |||||
| ->executeOne(); | |||||
| if (!$object) { | if (!$object) { | ||||
| throw new Exception(pht('No such object with PHID "%s".', $phid)); | throw new Exception(pht('No such object with PHID "%s".', $phid)); | ||||
| } | } | ||||
| $this->setIsCreate(false); | |||||
| } else { | } else { | ||||
| $object = $this->newEditableObject(); | |||||
| $this->setIsCreate(true); | $this->setIsCreate(true); | ||||
| $object = $this->newEditableObject(); | |||||
| } | } | ||||
| $fields = $this->buildEditFields($object); | $fields = $this->buildEditFields($object); | ||||
| foreach ($fields as $field) { | |||||
| $field | |||||
| ->setViewer($viewer) | |||||
| ->setObject($object); | |||||
| } | |||||
| $types = $this->getAllEditTypesFromFields($fields); | $types = $this->getAllEditTypesFromFields($fields); | ||||
| $template = $object->getApplicationTransactionTemplate(); | $template = $object->getApplicationTransactionTemplate(); | ||||
| $xactions = $this->getConduitTransactions($request, $types, $template); | $xactions = $this->getConduitTransactions($request, $types, $template); | ||||
| $editor = $object->getApplicationTransactionEditor() | $editor = $object->getApplicationTransactionEditor() | ||||
| ->setActor($viewer) | ->setActor($viewer) | ||||
| ->setContentSourceFromConduitRequest($request) | ->setContentSourceFromConduitRequest($request) | ||||
| ▲ Show 20 Lines • Show All 106 Lines • ▼ Show 20 Lines | /* -( Conduit )------------------------------------------------------------ */ | ||||
| public function getAllEditTypes() { | public function getAllEditTypes() { | ||||
| $object = $this->newEditableObject(); | $object = $this->newEditableObject(); | ||||
| $fields = $this->buildEditFields($object); | $fields = $this->buildEditFields($object); | ||||
| return $this->getAllEditTypesFromFields($fields); | return $this->getAllEditTypesFromFields($fields); | ||||
| } | } | ||||
| } | } | ||||