Skip to content

Commit

Permalink
(feat): add explanation to 'show on' taxonomy form
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdhoek1 committed May 28, 2021
1 parent 20db422 commit deca336
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Version [2.0.8]

- Add explanation to 'show on' taxonomy form.

## Version [2.0.7]

### Refactor
Expand Down
Binary file modified languages/openpub-base-nl_NL.mo
Binary file not shown.
8 changes: 8 additions & 0 deletions languages/openpub-base-nl_NL.po
Original file line number Diff line number Diff line change
Expand Up @@ -636,3 +636,11 @@ msgstr "Verbindingstype \"%s\" bestaat niet"

#~ msgid "This link does not work, go to our website: <a href=\"%s\">%s</a>"
#~ msgstr "Deze link werkt niet, bekijk onze website: <a href=\"%s\">%s</a>"

#: src/Base/Taxonomy/TaxonomyController.php:21
msgid "Additional explanation"
msgstr "Aanvullende uitleg"

#: src/Base/Taxonomy/TaxonomyController.php:22
msgid "The slug value must be the ID of the blog you want to add as term. The ID is used for displaying the correct openpub-items on every blog."
msgstr "De waarde van de slug moet het ID zijn van de blog die je wilt toevoegen als term. Het ID wordt gebruikt om de juiste openpub-items weer te geven op alle blogs."
8 changes: 8 additions & 0 deletions languages/openpub-base.pot
Original file line number Diff line number Diff line change
Expand Up @@ -422,3 +422,11 @@ msgstr ""
#, php-format
msgid "Connection type \"%s\" does not exist"
msgstr ""

#: src/Base/Taxonomy/TaxonomyController.php:21
msgid "Additional explanation"
msgstr ""

#: src/Base/Taxonomy/TaxonomyController.php:22
msgid "The slug value must be the ID of the blog you want to add as term. The ID is used for displaying the correct openpub-items on every blog."
msgstr ""
2 changes: 1 addition & 1 deletion openpub-base.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin Name: Yard | OpenPub Base
* Plugin URI: https://www.openwebconcept.nl/
* Description: Acts as foundation for other OpenPub related content plugins. This plugin implements actions to allow for other plugins to add and/or change Custom Posttypes, Metaboxes, Taxonomies, en Posts 2 posts relations.
* Version: 2.0.7
* Version: 2.0.8
* Author: Yard | Digital Agency
* Author URI: https://www.yard.nl/
* License: GPL-3.0
Expand Down
2 changes: 1 addition & 1 deletion src/Base/Foundation/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Plugin
*
* @var string VERSION
*/
const VERSION = '2.0.7';
const VERSION = '2.0.8';

/**
* Path to the root of the plugin.
Expand Down
25 changes: 25 additions & 0 deletions src/Base/Taxonomy/TaxonomyController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace OWC\OpenPub\Base\Taxonomy;

class TaxonomyController
{
/**
* Add 'show on' additional explanation.
*
* @param string $taxonomy
*
* @return void
*/
public function addShowOnExplanation(string $taxonomy): void
{
if ('openpub-show-on' !== $taxonomy) {
return;
}

echo '<div class="form-field">
<h3>' . __('Additional explanation', 'openpub-base') . '</h3>
<p>' . __('The slug value must be the ID of the blog you want to add as term. The ID is used for displaying the correct openpub-items on every blog.', 'openpub-base') . '</p>
</div>';
}
}
16 changes: 15 additions & 1 deletion src/Base/Taxonomy/TaxonomyServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,24 @@ class TaxonomyServiceProvider extends ServiceProvider
public function register(): void
{
$this->plugin->loader->addAction('init', $this, 'registerTaxonomies');

if ($this->plugin->settings->useShowOn()) {
$this->showOnFormFields();
}
}

/**
* Add elements to the taxonomy form.
*
* @return void
*/
protected function showOnFormFields()
{
$this->plugin->loader->addAction('openpub-show-on_add_form_fields', TaxonomyController::class, 'addShowOnExplanation');
}

/**
* Register custom taxonomies via extended_cpts
* Register custom taxonomies via extended_cpts.
*
* @return void
*/
Expand Down

0 comments on commit deca336

Please sign in to comment.