[TASK] Make DbTableViewHelper compatible to TYPO3 9
This commit is contained in:
parent
4b78ff8eaf
commit
b2a7731311
@ -4,6 +4,7 @@ namespace Cjel\TemplatesAide\ViewHelpers;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Core\Database\ConnectionPool;
|
||||
use TYPO3\CMS\Core\Database\Connection;
|
||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
||||
|
||||
class DbTableViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper {
|
||||
|
||||
@ -15,16 +16,34 @@ class DbTableViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHel
|
||||
protected $escapeOutput = false;
|
||||
|
||||
/**
|
||||
* @param string $table The filename
|
||||
* @param string $fields The filename
|
||||
* @param string $where
|
||||
* @param string $orderBy
|
||||
* Initialize arguments
|
||||
*/
|
||||
public function initializeArguments() {
|
||||
parent::initializeArguments();
|
||||
$this->registerArgument('table', 'string', '', true);
|
||||
$this->registerArgument('fields', 'array', '', true, ['*']);
|
||||
$this->registerArgument('where', 'array', '', true);
|
||||
$this->registerArgument('orderBy', 'array', '', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $table
|
||||
* @param array $fields
|
||||
* @param array $where
|
||||
* @param array $orderBy
|
||||
* @return string HTML Content
|
||||
*/
|
||||
public function render($table, $fields = ['*'], $where = [], $orderBy = []){
|
||||
public static function renderStatic(
|
||||
array $arguments,
|
||||
\Closure $renderChildrenClosure,
|
||||
RenderingContextInterface $renderingContext
|
||||
) {
|
||||
$table = $arguments['table'];
|
||||
$fields = $arguments['fields'];
|
||||
$where = $arguments['where'];
|
||||
$orderBy = $arguments['orderBy'];
|
||||
|
||||
|
||||
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable('pages')->createQueryBuilder();
|
||||
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable($table)->createQueryBuilder();
|
||||
|
||||
$whereExpressions = [];
|
||||
if (!empty($where)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user