<?php
|
// /taxonomies/media.php
|
use JVBase\registrar\Registrar;
|
|
if (!defined('ABSPATH')) {
|
exit;
|
}
|
|
|
add_action('plugins_loaded', 'ajv_media',1);
|
//Add fields later so we can verify taxonomies/post types exist
|
add_action('plugins_loaded', 'ajv_media_fields', 2);
|
|
add_filter('ajv_MediaSchemaDefault', 'ajv_media_schema');
|
add_filter('ajv_MediaMetaDefault', 'ajv_media_meta');
|
add_filter('ajv_MediaArchiveDefault', 'ajv_media_archive');
|
|
function ajv_media(){
|
if (!class_exists('JVBase\registrar\Registrar')) {
|
return;
|
}
|
$media = Registrar::forTerm('media', 'Medium', 'Media')
|
->setIcon('scribble')
|
->make([
|
'rewrite' => [
|
'slug' => 'in/media',
|
'with_front' => false,
|
],
|
'for' => [
|
'art',
|
'design',
|
'development',
|
'strategy',
|
'writing'
|
],
|
'hierarchical' => true,
|
])
|
->setAll([
|
'show_feed',
|
'show_directory',
|
]);
|
}
|
|
function ajv_media_fields():void
|
{
|
if (!class_exists('JVBase\registrar\Registrar')) {
|
return;
|
}
|
$media = Registrar::getInstance('media');
|
|
//$directory = $media->getConfig('directory');
|
//$breadcrumbs = $media->config('breadcrumbs');
|
//$breadcrumbs->setCrumb('project');
|
|
$fields = $media->fields();
|
$fields->addCommon('wiki');
|
}
|
|
//function ajv_media():array
|
//{
|
// return [
|
// 'singular' => 'Medium',
|
// 'plural' => 'Media',
|
// 'description' => [
|
// '<b>What it\'s made of.</b>',
|
// 'From clay to oil paints'
|
// ],
|
// 'icon' => 'diamonds-four',
|
// 'show_feed' => true,
|
// 'show_directory' => true,
|
// 'approve_new' => true,
|
// 'rewrite' => [
|
// 'slug' => 'media',
|
// 'with_front' => false,
|
// 'hierarchical' => true,
|
// ],
|
// 'hierarchical' => true,
|
// 'for_content' => [
|
// 'art'
|
// ],
|
// 'seo' => [
|
// 'schema' => [
|
// 'type' => 'DefinedTerm',
|
// 'name' => '{{name}}',
|
// 'description' => '{{description}}',
|
// ],
|
// 'meta' => [
|
// 'title' => '{{name}} Art | JakeVan',
|
// 'description' => '{{description}}',
|
// ],
|
// 'archive' => [
|
// 'type' => 'CollectionPage',
|
// 'name' => '{{name}} Artwork',
|
// ],
|
// ],
|
// 'fields' => [
|
// 'term_name' => [
|
// 'label' => 'Name',
|
// 'type' => 'text',
|
// 'quickEdit' => true,
|
// ],
|
// 'common' => [ 'wiki' ]
|
// ]
|
// ];
|
//}
|
|
|
function ajv_media_schema():array
|
{
|
return [
|
// 'type' => 'JVBase\managers\SEO\render\Thing\CreativeWork\CreativeWork',
|
'name' => '{{name}} Artwork',
|
'description' => '{{description}}',
|
];
|
}
|
|
function ajv_media_meta():array
|
{
|
return[
|
'name' => '{{name}} | Human-made Art',
|
];
|
}
|
|
function ajv_media_archive(array $defaults):array
|
{
|
return array_merge($defaults, [
|
'name' => 'Canadian {{name}} Artwork. Made in Edmonton, Alberta.',
|
]);
|
}
|
|
function ajv_media_reference_schema(array $defaults):array
|
{
|
return $defaults;
|
}
|