Last active
August 30, 2017 15:15
-
-
Save dmitryd/f86cb00437ded943bee2 to your computer and use it in GitHub Desktop.
TYPO3 Extbase and "Insert records"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace DmitryDulepov\Myext\Controller; | |
class MyController { | |
/** | |
* @var \DmitryDulepov\Myext\\Domain\Repository\RecordRepository | |
* @inject | |
*/ | |
protected $recordRepository; | |
/** | |
* The usual action to show a single view of the record. | |
* | |
* @param \DmitryDulepov\Myext\Domain\Model\Record $record | |
* @return void | |
*/ | |
public function showAction(\DmitryDulepov\Myext\Domain\Model\Record $record) { | |
if (!$recipe) { | |
/** @noinspection PhpUndefinedMethodInspection */ | |
$GLOBALS['TSFE']->pageNotFoundAndExit(LocalizationUtility::translate('show.notFound', 'myext')); | |
} | |
$this->view->assign('record', $record); | |
} | |
/** | |
* A special action that is called for "Insert records" only. | |
* | |
* @return void | |
*/ | |
public function showFromRecords() { | |
$contentObject = $this->configurationManager->getContentObject(); | |
if ($contentObject->data['uid']) { | |
$record = $this->recordRepository->findByUid((int)$contentObject->data['uid']); | |
$this->forward('show', NULL, NULL, array('record' => $record)); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToInsertRecords('tx_myext_domain_model_record'); | |
// ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tt_content.shortcut.20.tables := addToList(tx_myext_domain_model_record) | |
tx_myext_domain_model_record < plugin.tx_myext | |
tx_myext_domain_model_record = USER | |
tx_myext_domain_model_record { | |
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run | |
pluginName = Pluginname | |
extensionName = Myext | |
controllerConfiguration { | |
MyController { | |
actions = showFromRecords,show | |
} | |
} | |
vendorName = DmitryDulepov | |
action = showFromRecords | |
switchableControllerActions { | |
MyController { | |
1 = showFromRecords | |
2 = show | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin('dmitrydulepov.myext', 'Pluginname', array('MyController' => 'show,showFromRecords')); | |
// ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment