<?php

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

use Carbon_Fields\Field\Field;

$gigneo_detail_fields[] = Field::make( 'rich_text', 'gigneo_pm_description', esc_html__( 'Description', 'gigneo' ) )
	->set_classes( 'gn-pm-field-full' );

$gigneo_licence_list = array();
$gigneo_licence      = new WP_Term_Query(
	array(
		'taxonomy'   => 'gigneo_license',
		'hide_empty' => false,
	)
);

if ( ! is_wp_error( $gigneo_licence ) && ! empty( $gigneo_licence->terms ) ) {
	foreach ( $gigneo_licence->terms as $gigneo_licence ) {
		$gigneo_licence_list[ $gigneo_licence->slug ] = $gigneo_licence->name;
	}
}

$gigneo_detail_fields[] = Field::make(
	'select',
	'gigneo_pm_job_licenses',
	esc_html__( 'Required licence', 'gigneo' )
)
	->set_options( $gigneo_licence_list )
	->set_classes( 'gn-select2' );
