Skip to content

Commit

Permalink
Add Backend config() method
Browse files Browse the repository at this point in the history
Added config method to allow the user to pass any flatpickr config to the component from the form field.
  • Loading branch information
coolsam726 authored Aug 25, 2022
1 parent c8db7e1 commit 2d951fd
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/Flatpickr.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class Flatpickr extends Field
protected bool $multiplePicker = false;

protected bool $altInput = true;

protected array $config = [];

protected ?string $altFormat = 'F j, Y';

Expand Down Expand Up @@ -47,6 +49,24 @@ public function isWeekSelect(): bool
{
return $this->weekSelect;
}

/**
* @param array $config
* @return Flatpickr
*/
public function config(array|\Closure $config): Flatpickr
{
$this->config = $config;
return $this;
}

/**
* @return array
*/
public function getConfig(): array
{
return $this->config;
}

/**
* @param bool $rangePicker
Expand Down

0 comments on commit 2d951fd

Please sign in to comment.