Skip to content

Commit

Permalink
feat: added functionality to add serp title and description to transl…
Browse files Browse the repository at this point in the history
…ated categories (#3120) (#3144)
  • Loading branch information
modelrailroader authored Jul 30, 2024
1 parent 8fc8443 commit 50c642d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
15 changes: 15 additions & 0 deletions phpmyfaq/admin/category.main.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,21 @@
$permissions['restricted_groups']
)
) {
// Add SERP-Title and Description to translated category
$seoEntity = new SeoEntity();
$seoEntity
->setType(SeoType::CATEGORY)
->setReferenceId($categoryEntity->getId())
->setReferenceLanguage($categoryEntity->getLang())
->setTitle(Filter::filterInput(INPUT_POST, 'serpTitle', FILTER_SANITIZE_SPECIAL_CHARS))
->setDescription(Filter::filterInput(INPUT_POST, 'serpDescription', FILTER_SANITIZE_SPECIAL_CHARS));

if ($seo->get(clone $seoEntity)->getId() === null) {
$seo->create($seoEntity);
} else {
$seo->update($seoEntity);
}

$templateVars = [
...$templateVars,
'isSuccess' => true,
Expand Down
17 changes: 17 additions & 0 deletions phpmyfaq/assets/templates/admin/content/category.translate.twig
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,23 @@
</div>
</div>

<!-- SERP Title -->
<div class="row mb-2">
<label class="col-lg-2 col-form-label" for="serpTitle">{{ 'msgSerpTitle' | translate }}</label>
<div class="col-lg-4">
<input type="text" name="serpTitle" id="serpTitle" value="" class="form-control">
</div>
</div>

<!-- SERP Description -->
<div class="row mb-2">
<label class="col-lg-2 col-form-label" for="serpDescription">{{ 'msgSerpDescription' | translate }}</label>
<div class="col-lg-4">
<textarea type="text" name="serpDescription" id="serpDescription" rows="5" class="form-control">
</textarea>
</div>
</div>

<div class="row mb-2">
<label class="col-lg-2 col-form-label">{{ ad_categ_transalready }}</label>
<div class="col-lg-4">
Expand Down

0 comments on commit 50c642d

Please sign in to comment.