Skip to content

Commit

Permalink
rex_stan fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alxndr-w committed Dec 16, 2023
1 parent 838818e commit cce9108
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 68 deletions.
4 changes: 3 additions & 1 deletion lib/neues_author.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function setText(string $value): self
*/
public function getBeUserId(): ?int
{
return $this->getValue('be_user_id');
return (int) $this->getValue('be_user_id');
}

/**
Expand Down Expand Up @@ -170,6 +170,8 @@ public function setBeUserId(int $value): self
*
* Beispiel / Example:
* $beUser = $author->getBeUser();
*
* @api
*/
public function getBeUser(): ?rex_user
{
Expand Down
4 changes: 3 additions & 1 deletion lib/neues_category.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public function getName(): string
*
* Beispiel / Example:
* $category->setName('Neuer Name');
*
* @api
*/
public function setName(string $name): self
{
Expand All @@ -60,7 +62,7 @@ public function setName(string $name): self
*/
public function getEntries(): ?rex_yform_manager_collection
{
return $this->getRelatedDataset('entry_ids');
return $this->getRelatedCollection('entry_ids');
}

/**
Expand Down
5 changes: 4 additions & 1 deletion lib/neues_entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ public function setName(string $name): self
*/
public function getAuthor(): ?neues_author
{
return $this->getRelatedDataset('author');
if($this->getRelatedDataset('author')) {
return neues_author::get($this->getRelatedDataset('author')->getId());
}
return null;
}

/**
Expand Down
37 changes: 20 additions & 17 deletions pages/neues.author.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,28 @@

$currentPage = rex_be_controller::getCurrentPageObject();
$wrapper = '';
if ($table_name = 'rex_neues_author') {
if (!rex_request('table_name', 'string', '')) {
$_REQUEST['table_name'] = $table_name;
}

if (true !== $currentPage->getItemAttr('show_title', false)) {
rex_extension::register('YFORM_MANAGER_DATA_PAGE_HEADER', static function ($ep) {
if ($ep->getParam('yform')->table->getTableName() !== $ep->getParam('table_name')) {
return;
}
return '';
}, rex_extension::EARLY, ['table_name' => $table_name]);
}

if ($wrapper = $currentPage->getItemAttr('wrapper_class', '')) {
echo "<div class=\"$wrapper\">";
}

$table_name = 'rex_neues_author';

if (!rex_request('table_name', 'string', '')) {
/* @phpstan-ignore-next-line */
$_REQUEST['table_name'] = $table_name;
}

if (true !== $currentPage->getItemAttr('show_title', '')) {
rex_extension::register('YFORM_MANAGER_DATA_PAGE_HEADER', static function ($ep) {
if ($ep->getParam('yform')->table->getTableName() !== $ep->getParam('table_name')) {
return;
}
return '';
}, rex_extension::EARLY, ['table_name' => $table_name]);
}

if ($wrapper = $currentPage->getItemAttr('wrapper_class', '')) {
echo "<div class=\"$wrapper\">";
}


include rex_path::plugin('yform', 'manager', 'pages/data_edit.php');

if ($wrapper) {
Expand Down
36 changes: 19 additions & 17 deletions pages/neues.category.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,27 @@

$currentPage = rex_be_controller::getCurrentPageObject();
$wrapper = '';
if ($table_name = 'rex_neues_category') {
if (!rex_request('table_name', 'string', '')) {
$_REQUEST['table_name'] = $table_name;
}

if (true !== $currentPage->getItemAttr('show_title', false)) {
rex_extension::register('YFORM_MANAGER_DATA_PAGE_HEADER', static function ($ep) {
if ($ep->getParam('yform')->table->getTableName() !== $ep->getParam('table_name')) {
return;
}
return '';
}, rex_extension::EARLY, ['table_name' => $table_name]);
}

if ($wrapper = $currentPage->getItemAttr('wrapper_class', '')) {
echo "<div class=\"$wrapper\">";
}

$table_name = 'rex_neues_category';
if (!rex_request('table_name', 'string', '')) {
/* @phpstan-ignore-next-line */
$_REQUEST['table_name'] = $table_name;
}

if (true !== $currentPage->getItemAttr('show_title', '')) {
rex_extension::register('YFORM_MANAGER_DATA_PAGE_HEADER', static function ($ep) {
if ($ep->getParam('yform')->table->getTableName() !== $ep->getParam('table_name')) {
return;
}
return '';
}, rex_extension::EARLY, ['table_name' => $table_name]);
}

if ($wrapper = $currentPage->getItemAttr('wrapper_class', '')) {
echo "<div class=\"$wrapper\">";
}


include rex_path::plugin('yform', 'manager', 'pages/data_edit.php');

if ($wrapper) {
Expand Down
31 changes: 16 additions & 15 deletions pages/neues.entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,24 @@

$currentPage = rex_be_controller::getCurrentPageObject();
$wrapper = '';
if ($table_name = 'rex_neues_entry') {
if (!rex_request('table_name', 'string', '')) {
$_REQUEST['table_name'] = $table_name;
}

if (true !== $currentPage->getItemAttr('show_title', false)) {
rex_extension::register('YFORM_MANAGER_DATA_PAGE_HEADER', static function ($ep) {
if ($ep->getParam('yform')->table->getTableName() !== $ep->getParam('table_name')) {
return;
}
return '';
}, rex_extension::EARLY, ['table_name' => $table_name]);
}
$table_name = 'rex_neues_entry';
if (!rex_request('table_name', 'string', '')) {
/* @phpstan-ignore-next-line */
$_REQUEST['table_name'] = $table_name;
}

if (true !== $currentPage->getItemAttr('show_title', '')) {
rex_extension::register('YFORM_MANAGER_DATA_PAGE_HEADER', static function ($ep) {
if ($ep->getParam('yform')->table->getTableName() !== $ep->getParam('table_name')) {
return;
}
return '';
}, rex_extension::EARLY, ['table_name' => $table_name]);
}

if ($wrapper = $currentPage->getItemAttr('wrapper_class', '')) {
echo "<div class=\"$wrapper\">";
}
if ($wrapper = $currentPage->getItemAttr('wrapper_class', '')) {
echo "<div class=\"$wrapper\">";
}

include rex_path::plugin('yform', 'manager', 'pages/data_edit.php');
Expand Down
31 changes: 16 additions & 15 deletions pages/neues.lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,24 @@

$currentPage = rex_be_controller::getCurrentPageObject();
$wrapper = '';
if ($table_name = 'rex_neues_entry_Lang') {
if (!rex_request('table_name', 'string', '')) {
$_REQUEST['table_name'] = $table_name;
}

if (true !== $currentPage->getItemAttr('show_title', false)) {
rex_extension::register('YFORM_MANAGER_DATA_PAGE_HEADER', static function ($ep) {
if ($ep->getParam('yform')->table->getTableName() !== $ep->getParam('table_name')) {
return;
}
return '';
}, rex_extension::EARLY, ['table_name' => $table_name]);
}
$table_name = 'rex_neues_entry_Lang';
if (!rex_request('table_name', 'string', '')) {
/* @phpstan-ignore-next-line */
$_REQUEST['table_name'] = $table_name;
}

if (true !== $currentPage->getItemAttr('show_title', '')) {
rex_extension::register('YFORM_MANAGER_DATA_PAGE_HEADER', static function ($ep) {
if ($ep->getParam('yform')->table->getTableName() !== $ep->getParam('table_name')) {
return;
}
return '';
}, rex_extension::EARLY, ['table_name' => $table_name]);
}

if ($wrapper = $currentPage->getItemAttr('wrapper_class', '')) {
echo "<div class=\"$wrapper\">";
}
if ($wrapper = $currentPage->getItemAttr('wrapper_class', '')) {
echo "<div class=\"$wrapper\">";
}

include rex_path::plugin('yform', 'manager', 'pages/data_edit.php');
Expand Down
2 changes: 1 addition & 1 deletion pages/neues.settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
$form = rex_config_form::factory($addon->getName());

$field = $form->addMediaField('default_thumbnail');
$field->setPreview(1);
$field->setPreview(true);
$field->setTypes('jpg,gif,png');
$field->setLabel(rex_i18n::msg('neues_default_thumbnail'));

Expand Down

0 comments on commit cce9108

Please sign in to comment.