Skip to content

Commit

Permalink
Hide container item title on edit form
Browse files Browse the repository at this point in the history
  • Loading branch information
yurabakhtin committed Jan 31, 2025
1 parent 9e2060c commit e89878b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
12 changes: 1 addition & 11 deletions modules/template/models/forms/EditItemForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,18 @@ class EditItemForm extends EditMultipleElementsForm
{
public ?ContainerItem $item = null;

public $title;
public $editDefault = false;

public function rules()
{
return [
['title', 'string'],
];
}

public function scenarios()
{
return [
'edit' => ['title'],
'edit' => [],
];
}

public function setItem($itemId)
{
$this->item = ContainerItem::findOne(['id' => $itemId]);
$this->title = $this->item->title;
$this->owner = $this->item->templateInstance;
$this->setTemplate($this->owner->template_id);
}
Expand All @@ -48,7 +39,6 @@ public function save(): bool
{
if (parent::save()) {
if ($this->item instanceof ContainerItem) {
$this->item->title = $this->title;
return $this->item->save();
}
return true;
Expand Down
2 changes: 0 additions & 2 deletions modules/template/widgets/views/editItemModal.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
<?php $form = ActiveForm::begin(['action' => $action, 'enableClientValidation' => false]); ?>
<div class="modal-body media-body template-edit-multiple">

<?= $form->field($model, 'title')->textInput(['class' => 'form-control template-edit-multiple-title', 'placeholder' => Yii::t('CustomPagesModule.base', 'Item name'), 'autofocus' => ''])->label(false); ?>

<?php $counter = 0 ?>
<?php foreach ($model->contentMap as $key => $contentItem) : ?>

Expand Down

0 comments on commit e89878b

Please sign in to comment.