Skip to content

Commit

Permalink
Merge pull request #18 from teamneusta/add-date-and-link-items
Browse files Browse the repository at this point in the history
  • Loading branch information
jdreesen authored Feb 12, 2024
2 parents 37330ad + 064432b commit 8cf1bdc
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/DialogBoxBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

use Neusta\Pimcore\AreabrickConfigBundle\EditableDialogBox\EditableItem;
use Neusta\Pimcore\AreabrickConfigBundle\EditableDialogBox\EditableItem\CheckboxItem;
use Neusta\Pimcore\AreabrickConfigBundle\EditableDialogBox\EditableItem\DateItem;
use Neusta\Pimcore\AreabrickConfigBundle\EditableDialogBox\EditableItem\InputItem;
use Neusta\Pimcore\AreabrickConfigBundle\EditableDialogBox\EditableItem\LinkItem;
use Neusta\Pimcore\AreabrickConfigBundle\EditableDialogBox\EditableItem\NumericItem;
use Neusta\Pimcore\AreabrickConfigBundle\EditableDialogBox\EditableItem\RelationItem;
use Neusta\Pimcore\AreabrickConfigBundle\EditableDialogBox\EditableItem\SelectItem;
Expand Down Expand Up @@ -91,6 +93,16 @@ public function createNumeric(string $name, int $min, int $max): NumericItem
return new NumericItem($name, $min, $max);
}

public function createDate(string $name): DateItem
{
return new DateItem($name);
}

public function createLink(string $name): LinkItem
{
return new LinkItem($name);
}

public function build(): EditableDialogBoxConfiguration
{
if (!$this->tabs->isEmpty()) {
Expand Down
38 changes: 38 additions & 0 deletions src/EditableDialogBox/EditableItem/DateItem.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
declare(strict_types=1);

namespace Neusta\Pimcore\AreabrickConfigBundle\EditableDialogBox\EditableItem;

use Neusta\Pimcore\AreabrickConfigBundle\EditableDialogBox\EditableItem;

class DateItem extends EditableItem
{
public function __construct(string $name)
{
parent::__construct('date', $name);
}

/**
* @return $this
*/
public function setDefaultValue(string $value): static
{
return $this->addConfig('defaultValue', $value);
}

/**
* @return $this
*/
public function setFormat(string $value): static
{
return $this->addConfig('format', $value);
}

/**
* @return $this
*/
public function setOutputFormat(string $value): static
{
return $this->addConfig('outputFormat', $value);
}
}
14 changes: 14 additions & 0 deletions src/EditableDialogBox/EditableItem/LinkItem.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
declare(strict_types=1);

namespace Neusta\Pimcore\AreabrickConfigBundle\EditableDialogBox\EditableItem;

use Neusta\Pimcore\AreabrickConfigBundle\EditableDialogBox\EditableItem;

class LinkItem extends EditableItem
{
public function __construct(string $name)
{
parent::__construct('link', $name);
}
}

0 comments on commit 8cf1bdc

Please sign in to comment.