<commit_before><?php

namespace Taitava\SlickCarousel;

use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Core\ClassInfo;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\GridField\GridFieldConfig_RelationEditor;
use SilverStripe\Forms\Tab;
use SilverStripe\ORM\DataExtension;
use SilverStripe\ORM\DataList;
use SilverStripe\ORM\FieldType\DBHTMLText;

/**
 * Class CarouselExtension
 *
 * @method DataList CarouselSlides
 *
 * @property SiteTree|CarouselExtension $owner
 */
class CarouselExtension extends DataExtension
{
	private static $has_many = [
		'CarouselSlides' => CarouselSlide::class,
	];
	
	public function updateCMSFields(FieldList $fields)
	{
		$fields->addFieldToTab('Root', new Tab('Carousel', _t('Taitava\SlickCarousel\Carousel.CMSTabName', 'Carousel')));
		
		$gridfield_config = new GridFieldConfig_RelationEditor(Carousel::config()->get('cms_slides_per_page'));
		$sortable_rows_class = 'UndefinedOffset\SortableGridField\Forms\GridFieldSortableRows';
		if (ClassInfo::exists($sortable_rows_class))
		{
			//The SortableGridField module is installed - which is nice :)
			//See: https://github.com/UndefinedOffset/SortableGridField
			$gridfield_config->addComponent(Injector::inst()->create($sortable_rows_class,['Sort']));
		}
		
		$gridfield = new GridField('CarouselSlides', _t('Taitava\SlickCarousel\Carousel.CMSTabName', 'Carousel'), $this->owner->CarouselSlides(), $gridfield_config);
		$fields->addFieldToTab('Root.Carousel', $gridfield);
	}
	
	/**
	 * Renders the carousel using Carousel.ss (which will lead to include CarouselSlide.ss for each slide). If you wish
	 * to implement some custom iteration for the carousel slides, you can call $CarouselSlides in your template instead
	 * of this method.
	 *
	 * @return DBHTMLText
	 */
	public function Carousel()<commit_msg>MINOR: changing injected sort column to be an string instead of an array<commit_after><?php

namespace Taitava\SlickCarousel;

use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Core\ClassInfo;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\GridField\GridFieldConfig_RelationEditor;
use SilverStripe\Forms\Tab;
use SilverStripe\ORM\DataExtension;
use SilverStripe\ORM\DataList;
use SilverStripe\ORM\FieldType\DBHTMLText;

/**
 * Class CarouselExtension
 *
 * @method DataList CarouselSlides
 *
 * @property SiteTree|CarouselExtension $owner
 */
class CarouselExtension extends DataExtension
{
	private static $has_many = [
		'CarouselSlides' => CarouselSlide::class,
	];
	
	public function updateCMSFields(FieldList $fields)
	{
		$fields->addFieldToTab('Root', new Tab('Carousel', _t('Taitava\SlickCarousel\Carousel.CMSTabName', 'Carousel')));
		
		$gridfield_config = new GridFieldConfig_RelationEditor(Carousel::config()->get('cms_slides_per_page'));
		$sortable_rows_class = 'UndefinedOffset\SortableGridField\Forms\GridFieldSortableRows';
		if (ClassInfo::exists($sortable_rows_class))
		{
			//The SortableGridField module is installed - which is nice :)
			//See: https://github.com/UndefinedOffset/SortableGridField
			$gridfield_config->addComponent(Injector::inst()->create($sortable_rows_class, 'Sort'));
		}
		
		$gridfield = new GridField('CarouselSlides', _t('Taitava\SlickCarousel\Carousel.CMSTabName', 'Carousel'), $this->owner->CarouselSlides(), $gridfield_config);
		$fields->addFieldToTab('Root.Carousel', $gridfield);
	}
	
	/**
	 * Renders the carousel using Carousel.ss (which will lead to include CarouselSlide.ss for each slide). If you wish
	 * to implement some custom iteration for the carousel slides, you can call $CarouselSlides in your template instead
	 * of this method.
	 *
	 * @return DBHTMLText
	 */
	public function Carousel()
{'fraction_non_alphanumeric': 0.11580310880829016, 'fraction_numerical': 0.0, 'mean_word_length': 5.944244604316546, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1847386', 'n_tokens_mistral': 1289, 'n_tokens_neox': 1227, 'n_words': 248}