<commit_before><?php

namespace common\modules\issue\widgets;

use backend\helpers\Url;
use backend\modules\issue\models\IssueStageChangeForm;
use common\models\issue\IssueInterface;
use Yii;
use yii\bootstrap\ButtonDropdown;
use yii\helpers\ArrayHelper;

class StageChangeButtonDropdown extends ButtonDropdown {

	public string $route;
	public ?string $returnUrl = null;
	public $options = [
		'class' => 'btn-success',
	];
	public $tagName = 'a';
	public $split = true;
	public IssueInterface $model;

	public function init(): void {
		parent::init();
		if ($this->label === 'Button') {
			$this->label = Yii::t('issue', 'Change Stage');
		}
		if (!isset($this->dropdown['items'])) {
			$this->dropdown['items'] = $this->defaultItems();
		}
		if (!isset($this->options['href'])) {
			$this->options['href'] = [
				$this->route,
				'issueId' => $this->model->getIssueId(),
				'returnUrl' => $this->returnUrl,
			];
		}
	}

	public function defaultItems(): array {
		$stages = IssueStageChangeForm::getStagesNames($this->model->getIssueType()->id);
		unset($stages[$this->model->getIssueStage()->id]);
		asort($stages);
		$items = [];
		foreach ($stages as $id => $stage) {
			$items[] = [
				'label' => $stage,
				'linkOptions' => [
					'data-pjax' => 0,
				],
				'url' => Url::to([
					$this->route,
					'issueId' => $this->model->getIssueId(),
					'stageId' => $id,
					'returnUrl' => $this->returnUrl,
				]),
			];
		}
		return $items;
	}

}
<commit_msg>feat: add default without archives filter to LeadSearch.<commit_after><?php

namespace common\modules\issue\widgets;

use backend\helpers\Url;
use backend\modules\issue\models\IssueStageChangeForm;
use common\models\issue\IssueInterface;
use Yii;
use yii\bootstrap\ButtonDropdown;

class StageChangeButtonDropdown extends ButtonDropdown {

	public string $route;
	public ?string $returnUrl = null;
	public $options = [
		'class' => 'btn-success',
	];
	public $tagName = 'a';
	public $split = true;
	public IssueInterface $model;

	public function init(): void {
		parent::init();
		if ($this->label === 'Button') {
			$this->label = Yii::t('issue', 'Change Stage');
		}
		if (!isset($this->dropdown['items'])) {
			$this->dropdown['items'] = $this->defaultItems();
		}
		if (!isset($this->options['href'])) {
			$this->options['href'] = [
				$this->route,
				'issueId' => $this->model->getIssueId(),
				'returnUrl' => $this->returnUrl,
			];
		}
	}

	public function defaultItems(): array {
		$stages = IssueStageChangeForm::getStagesNames($this->model->getIssueType()->id);
		unset($stages[$this->model->getIssueStage()->id]);
		asort($stages);
		$items = [];
		foreach ($stages as $id => $stage) {
			$items[] = [
				'label' => $stage,
				'linkOptions' => [
					'data-pjax' => 0,
				],
				'url' => Url::to([
					$this->route,
					'issueId' => $this->model->getIssueId(),
					'stageId' => $id,
					'returnUrl' => $this->returnUrl,
				]),
			];
		}
		return $items;
	}

}

{'fraction_non_alphanumeric': 0.199255751014885, 'fraction_numerical': 0.0006765899864682003, 'mean_word_length': 3.8555008210180626, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 67, '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': '12115', 'n_tokens_mistral': 1175, 'n_tokens_neox': 1016, 'n_words': 193}