<?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\Producer;
defined('_JEXEC') or die;
use function YOOtheme\app;
use Joomla\CMS\Factory;
use YOOtheme\Builder\Source;
use YOOtheme\Path;
use YOOtheme\View;

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

			'fields' => [
				'producerfields' => [
					'type' => 'String',
					'extensions' => [
						'call' => __CLASS__ . '::producerExtraField',
					],
					'metadata' => [
						'label' => 'Producer Extra Field',
					],
				],

			],
			'metadata' => [
				'type' => true,
				'label' => 'Producer Extra Field',

			],
		];
	}
	public static function producerExtraField($attributes)
	{
		if($attributes->showLabel == '1'){
			return $attributes->name.$attributes->delimeter.$attributes->value;
		}else{
			return $attributes->delimeter.$attributes->value;
		}
	}
}
