<commit_before><?php 
namespace Tschallacka\TschForm\FormWidgets;

use Backend\Classes\FormWidgetBase;
use ApplicationException;
use Db;

class SelectAndAddToMany extends FormWidgetBase {
	public $defaultAlias = 'selectandaddtomany';
    public function widgetDetails()<commit_msg>Added a little inline documentation for selectandaddtomany<commit_after><?php 
namespace Tschallacka\TschForm\FormWidgets;

use Backend\Classes\FormWidgetBase;
use ApplicationException;
use Db;

/**
 *   The intention of this class is to allow easy insertion in to the belongstomany tables where things belong to eachother.
 *   The following implementation example assumes you have a belongsToMany relationship named "hotels"
 * 
 *   You'll need to add in your model the method onFormFIELDNAMEInject(Modelclass, session value)
 *   onFormHotelsInject($orig, $session=null) {
	     $this->hotels()->attach($orig);
 *   }
 *   And in fields.yaml you can use this to implement the correct list display and which relationfield.
 *   hotels:
 *      buttonlabel: Add Hotels
 *      type: selectandaddtomany
 *      relationfield: hotels
 *      notpossibleyet: Please save this thing if you wish to be able to add standard segments(CTRL + S)
 *      listconfig: ~/plugins/author/someplugin/controllers/hotelcontroller/config_list.yaml
 *

class SelectAndAddToMany extends FormWidgetBase {
	public $defaultAlias = 'selectandaddtomany';
    public function widgetDetails()
{'fraction_non_alphanumeric': 0.0718232044198895, 'fraction_numerical': 0.0, 'mean_word_length': 4.75, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '4149723', 'n_tokens_mistral': 400, 'n_tokens_neox': 399, 'n_words': 132}