Skip to content

Commit

Permalink
Added weekStartsOnMonday and weekStartsOnSunday
Browse files Browse the repository at this point in the history
  • Loading branch information
vinkla committed Oct 28, 2023
1 parent 09daed9 commit 942eecc
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,9 @@ Oembed::make('Tweet')
**WYSIWYG** - The [WYSIWYG field](https://www.advancedcustomfields.com/resources/wysiwyg-editor) creates a full WordPress tinyMCE content editor.

```php
use Extended\ACF\Fields\WysiwygEditor;
use Extended\ACF\Fields\WYSIWYGEditor;

WysiwygEditor::make('Content')
WYSIWYGEditor::make('Content')
->instructions('Add the text content.')
->tabs('visual') // all, text, visual (default)
->toolbar(['bold', 'italic', 'link']) // aligncenter, alignleft, alignright, blockquote, bold, bullist, charmap, forecolor, formatselect, fullscreen, hr, indent, italic, link, numlist, outdent, pastetext, redo, removeformat, spellchecker, strikethrough, underline, undo, wp_adv, wp_help, wp_more
Expand Down Expand Up @@ -374,6 +374,9 @@ DateTimePicker::make('Event Date', 'date')
->instructions('Add the event\'s start date and time.')
->displayFormat('d-m-Y H:i')
->returnFormat('d-m-Y H:i')
->firstDayOfWeek(0) // with Sunday 0 and Monday as 1
->weekStartsOnMonday() // or
->weekStartsOnSunday() // or
->required()
```

Expand Down Expand Up @@ -864,7 +867,9 @@ The `weekStartsOn` method has been renamed to `firstDayOfWeek`.

```diff
-DatePicker::make('Date')->weekStartsOn(1)
+DatePicker::make('Date')->firstDayOfWeek(1)
+DatePicker::make('Date')->firstDayOfWeek(1) // or
+DatePicker::make('Date')->weekStartsOnMonday() // or
+DatePicker::make('Date')->weekStartsOnSunday() // or
```

The `prepend` method has been renamed to `prefix`.
Expand Down Expand Up @@ -930,14 +935,14 @@ The `delay` method has been renamed to `lazyLoad`.

```diff
-WysiwygEditor::make('Biography')->delay()
+WysiwygEditor::make('Biography')->lazyLoad()
+WYSIWYGEditor::make('Biography')->lazyLoad()
```

The `mediaUpload` method has been renamed to `disableMediaUpload`.

```diff
-WysiwygEditor::make('Narrative')->mediaUpload(false)
+WysiwygEditor::make('Narrative')->disableMediaUpload()
+WYSIWYGEditor::make('Narrative')->disableMediaUpload()
```

The `MimeTypes` trait has been renamed to `FileTypes`.
Expand Down
10 changes: 10 additions & 0 deletions src/Fields/Settings/WeekDay.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,14 @@ public function firstDayOfWeek(int $day): static

return $this;
}

public function weekStartsOnMonday(): static
{
return $this->firstDayOfWeek(1);
}

public function weekStartsOnSunday(): static
{
return $this->firstDayOfWeek(0);
}
}
12 changes: 12 additions & 0 deletions tests/Fields/Settings/WeekDay.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,16 @@ public function testFirstDayOfWeek()
$field = $this->make('First Day Of Week')->firstDayOfWeek(1)->get();
$this->assertSame(1, $field['first_day']);
}

public function testWeekStartsOnMonday()
{
$field = $this->make('Week Starts On Monday')->weekStartsOnMonday()->get();
$this->assertSame(1, $field['first_day']);
}

public function testWeekStartsOnSunday()
{
$field = $this->make('Week Starts On Sunday')->weekStartsOnSunday()->get();
$this->assertSame(0, $field['first_day']);
}
}

0 comments on commit 942eecc

Please sign in to comment.