Skip to content

Commit

Permalink
(refactor): CMB2 'show on' taxonomy field type from 'select_advanced'…
Browse files Browse the repository at this point in the history
… to 'taxonomy_multicheck'
  • Loading branch information
Mike van den Hoek committed Apr 26, 2024
1 parent bf21911 commit 9df8fe1
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 24 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v3.4.4

- Refactor: CMB2 'show on' taxonomy field type from 'select_advanced' to 'taxonomy_multicheck'

## v3.4.3

- Chore: Updated CMB2 to version 2.11.0
Expand Down
31 changes: 14 additions & 17 deletions config/show_on_metabox.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,22 @@

return [
'show_on' => [
'id' => 'show_on',
'title' => __('External', 'openpub-base'),
'id' => 'show_on',
'title' => __('External', 'openpub-base'),
'object_types' => ['openpub-item'],
'context' => 'normal',
'priority' => 'low',
'autosave' => true,
'fields' => [
'context' => 'normal',
'priority' => 'low',
'autosave' => true,
'fields' => [
'settings' => [
[
'name' => __('Show on', 'openpub-base'),
'desc' => __('Select websites where this item should be displayed on.', 'openpub-base'),
'id' => 'show_on_active',
'type' => 'taxonomy_select',
'taxonomy' => 'openpub-show-on',
'field_type' => 'select_advanced',
'required' => 1,
'multiple' => 1
'name' => __('Show on', 'openpub-base'),
'desc' => __('Select websites where this item should be displayed on.', 'openpub-base'),
'id' => 'show_on_active',
'type' => 'taxonomy_multicheck',
'taxonomy' => 'openpub-show-on',
],
]
]
]
],
],
],
];
4 changes: 2 additions & 2 deletions 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: 3.4.3
* Version: 3.4.4
* Author: Yard | Digital Agency
* Author URI: https://www.yard.nl/
* License: GPL-3.0
Expand All @@ -16,7 +16,7 @@
/**
* If this file is called directly, abort.
*/
if (!defined('WPINC')) {
if (! defined('WPINC')) {
die;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Base/Foundation/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Plugin
* Version of the plugin.
* Used for setting versions of enqueue scripts and styles.
*/
public const VERSION = '3.4.3';
public const VERSION = '3.4.4';

/**
* Path to the root of the plugin.
Expand Down Expand Up @@ -155,7 +155,7 @@ public function callServiceProviders(string $method, string $key = ''): void

$service = new $service($this);

if (!$service instanceof ServiceProvider) {
if (! $service instanceof ServiceProvider) {
throw new \Exception('Provider must be an instance of ServiceProvider.');
}

Expand Down
6 changes: 3 additions & 3 deletions src/Base/Metabox/MetaboxServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class MetaboxServiceProvider extends ServiceProvider
{
public const PREFIX = '_owc_';

public function register()
{
$this->plugin->loader->addAction('cmb2_admin_init', $this, 'registerMetaboxes', 10, 0);
Expand All @@ -25,7 +25,7 @@ public function register()
public function registerMetaboxes(): void
{
$configMetaboxes = $this->plugin->config->get('cmb2_metaboxes');

if (! is_array($configMetaboxes)) {
return;
}
Expand Down Expand Up @@ -77,7 +77,7 @@ protected function registerMetaboxFields(CMB2 $metabox, array $fields): void
{
foreach ($fields as $field) {
$fieldKeys = array_keys($field);

foreach ($fieldKeys as $fieldKey) {
if (! is_array($field[$fieldKey])) {
continue;
Expand Down

0 comments on commit 9df8fe1

Please sign in to comment.