<?php
/**
 * @package DJ-Catalog2-Yootheme
 * @copyright Copyright (C) DJ-Extensions.com, All rights reserved.
 * @license http://www.gnu.org/licenses GNU/GPL
 * @author url: http://dj-extensions.com
 * @author email contact@dj-extensions.com
 */

namespace DJExtensions\DJCatalog2\YOOtheme\Builder\Source\Type\Category;
defined('_JEXEC') or die;
use function YOOtheme\app;
use Joomla\CMS\Factory;
use YOOtheme\Builder\Source;
use YOOtheme\Path;
use YOOtheme\View;

class CategoryImagesType
{

	/**
	 * @return array
	 */
	public static function config()
	{
		return [

			'fields' => [
				'gallery' => [
					'type' => 'String',
					'metadata' => [
						'label' => 'Gallery',
					],
					'extensions' => [
						'call' => __CLASS__ . '::gallery',
					],
				],
				'caption' => [
					'type' => 'String',
					'metadata' => [
						'label' => 'Image Caption',
						'filters' => ['limit'],
					],
					'extensions' => [
						'call' => __CLASS__ . '::image_caption',
					],
				],
				'name' => [
					'type' => 'String',
					'metadata' => [
						'label' => 'Image Name',
					],
					'extensions' => [
						'call' => __CLASS__ . '::image_name',
					],
				],
				'thumb' => [
					'type' => 'String',
					'metadata' => [
						'label' => 'Image Thumbnails',
					],
					'extensions' => [
						'call' => __CLASS__ . '::image_thumb',
					],
				],
				'cat_name' => [
					'type' => 'String',
					'metadata' => [
						'label' => 'Category Name',
					],
					'extensions' => [
						'call' => __CLASS__ . '::cat_name',
					],
				],

				'cat_description' => [
					'type' => 'String',
					'metadata' => [
						'label' => 'Category Description',
					],
					'extensions' => [
						'call' => __CLASS__ . '::cat_description',
					],
				],
			],
			'metadata' => [
				'type' => true,
				'label' => 'Category Image Gallery',
			],

		];
	}

	public static function gallery($category)
	{
		return $category['img_url'];
	}

	public static function image_name($category){
		return $category['img_name'];
	}

	public static function image_caption($category){
		return $category['img_caption'];
	}

	public static function image_thumb($category){
		return $category['img_thumb'];
	}

	public static function cat_name($category){
		return $category['name'];
	}

	public static function cat_description($category){
		return $category['description'];
	}


}
