fix l11n call

This commit is contained in:
Dennis Eichhorn 2021-06-24 00:09:34 +02:00
parent 03a7dd357a
commit 896dc8ed69
4 changed files with 5 additions and 14 deletions

View File

@ -123,18 +123,9 @@ final class ApiController extends Controller
}
$tag = $this->createTagFromRequest($request);
$tag->setL11n($request->getData('title'), $request->getData('language'));
$this->createModel($request->header->account, $tag, TagMapper::class, 'tag', $request->getOrigin());
$l11nRequest = new HttpRequest($request->uri);
$l11nRequest->setData('tag', $tag->getId());
$l11nRequest->setData('title', $request->getData('title'));
$l11nRequest->setData('language', $request->getData('language'));
$l11nTag = $this->createTagL11nFromRequest($l11nRequest);
$this->createModel($request->header->account, $l11nTag, TagL11nMapper::class, 'tag_l11n', $request->getOrigin());
$tag->setTitle($l11nTag);
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Tag', 'Tag successfully created', $tag);
}

View File

@ -146,7 +146,7 @@ class Tag implements \JsonSerializable, ArrayableInterface
*
* @since 1.0.0
*/
public function getTitle() : string
public function getL11n() : string
{
return $this->title instanceof TagL11n ? $this->title->title : $this->title;
}
@ -161,7 +161,7 @@ class Tag implements \JsonSerializable, ArrayableInterface
*
* @since 1.0.0
*/
public function setTitle($title, string $lang = ISO639x1Enum::_EN) : void
public function setL11n($title, string $lang = ISO639x1Enum::_EN) : void
{
if ($title instanceof TagL11n) {
$this->title = $title;

View File

@ -38,7 +38,7 @@ echo $this->getData('nav')->render(); ?>
$url = UriFactory::build('{/prefix}tag/single?{?}&id=' . $value->getId()); ?>
<tr tabindex="0" data-href="<?= $url; ?>">
<td data-label="<?= $this->getHtml('Title'); ?>"><a href="<?= $url; ?>"><span class="tag" style="background: <?= $this->printHtml(\substr($value->color, 0, 7)); ?>">&nbsp;&nbsp;&nbsp;<?= $value->icon !== null ? '<i class="' . $this->printHtml($value->icon ?? '') . '"></i>' : '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; ?>&nbsp;</span></a>
<td data-label="<?= $this->getHtml('Title'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->getTitle()); ?></a>
<td data-label="<?= $this->getHtml('Title'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->getL11n()); ?></a>
<?php endforeach; ?>
<?php if ($count === 0) : ?>

View File

@ -29,7 +29,7 @@ echo $this->getData('nav')->render(); ?>
<div class="portlet-body">
<table class="layout wf-100" style="table-layout: fixed">
<tr><td><label for="iTitle"><?= $this->getHtml('Title'); ?></label>
<tr><td><input type="text" name="title" id="iTitle" placeholder="&#xf040; oms" value="<?= $this->printHtml($tag->getTitle()); ?>" required>
<tr><td><input type="text" name="title" id="iTitle" placeholder="&#xf040; oms" value="<?= $this->printHtml($tag->getL11n()); ?>" required>
<tr><td><label for="iColor"><?= $this->getHtml('Color'); ?></label>
<tr><td><input type="color" name="color" id="iColor" value="<?= $this->printHtml(\substr($tag->color, 0, 7)); ?>" required>
<tr><td><label for="iIcon"><?= $this->getHtml('Icon'); ?></label>