Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
skeeks-semenov committed Aug 24, 2017
1 parent cd3260b commit ac56b16
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/messages/ru/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,8 @@
'Activity' => 'Активность',


'Selection widget in the dialog box' => 'Виджет выбора в диалоговом окне',
'Selection widget in the dialog box (multiple choice)' => 'Виджет выбора в диалоговом окне (множественный выбор)',

//TreeMenuWidget
'The parent section' => 'Родительский раздел',
Expand Down
38 changes: 33 additions & 5 deletions src/relatedProperties/propertyTypes/PropertyTypeElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* @date 30.04.2015
*/
namespace skeeks\cms\relatedProperties\propertyTypes;
use skeeks\cms\backend\widgets\SelectModelDialogContentElementWidget;
use skeeks\cms\components\Cms;
use skeeks\cms\models\CmsContentElement;
use skeeks\cms\relatedProperties\models\RelatedPropertiesModel;
Expand All @@ -22,10 +23,12 @@ class PropertyTypeElement extends PropertyType
public $code = self::CODE_ELEMENT;
public $name = "";

const FIELD_ELEMENT_SELECT = "select";
const FIELD_ELEMENT_SELECT_MULTI = "selectMulti";
const FIELD_ELEMENT_RADIO_LIST = "radioList";
const FIELD_ELEMENT_CHECKBOX_LIST = "checkbox";
const FIELD_ELEMENT_SELECT = "select";
const FIELD_ELEMENT_SELECT_MULTI = "selectMulti";
const FIELD_ELEMENT_RADIO_LIST = "radioList";
const FIELD_ELEMENT_CHECKBOX_LIST = "checkbox";
const FIELD_ELEMENT_SELECT_DIALOG = "selectDialog";
const FIELD_ELEMENT_SELECT_DIALOG_MULTIPLE = "selectDialogMulti";

public $fieldElement = self::FIELD_ELEMENT_SELECT;
public $content_id;
Expand All @@ -37,6 +40,8 @@ static public function fieldElements()
self::FIELD_ELEMENT_SELECT_MULTI => \Yii::t('skeeks/cms','Combobox').' (select multiple)',
self::FIELD_ELEMENT_RADIO_LIST => \Yii::t('skeeks/cms','Radio Buttons (selecting one value)'),
self::FIELD_ELEMENT_CHECKBOX_LIST => \Yii::t('skeeks/cms','Checkbox List'),
self::FIELD_ELEMENT_SELECT_DIALOG => \Yii::t('skeeks/cms','Selection widget in the dialog box'),
self::FIELD_ELEMENT_SELECT_DIALOG_MULTIPLE => \Yii::t('skeeks/cms','Selection widget in the dialog box (multiple choice)'),
];
}

Expand All @@ -55,7 +60,11 @@ public function init()
*/
public function getIsMultiple()
{
if (in_array($this->fieldElement, [self::FIELD_ELEMENT_SELECT_MULTI, self::FIELD_ELEMENT_CHECKBOX_LIST]))
if (in_array($this->fieldElement, [
self::FIELD_ELEMENT_SELECT_MULTI
, self::FIELD_ELEMENT_CHECKBOX_LIST
, self::FIELD_ELEMENT_SELECT_DIALOG_MULTIPLE
]))
{
return true;
}
Expand Down Expand Up @@ -130,6 +139,25 @@ public function renderForActiveForm()
{
$field = parent::renderForActiveForm();
$field->checkboxList(ArrayHelper::map($find->all(), 'id', 'name'));
} else if ($this->fieldElement == self::FIELD_ELEMENT_SELECT_DIALOG)
{
$field = parent::renderForActiveForm();
$field->widget(
SelectModelDialogContentElementWidget::class,
[
'content_id' => $this->content_id
]
);
} else if ($this->fieldElement == self::FIELD_ELEMENT_SELECT_DIALOG_MULTIPLE)
{
$field = parent::renderForActiveForm();
$field->widget(
SelectModelDialogContentElementWidget::class,
[
'content_id' => $this->content_id,
'multiple' => true
]
);
}


Expand Down

0 comments on commit ac56b16

Please sign in to comment.