Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
saade committed Mar 28, 2024
1 parent 08775cd commit 016fd8d
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
- [Customizing actions](#customizing-actions)
- [Authorizing actions](#authorizing-actions)
- [Intercepting events](#intercepting-events)
- [Render Hooks](#render-hooks)
- [Tricks](#tricks)
- [Editing event after drag and drop](#editing-event-after-drag-and-drop)
- [Creating events on day selection](#creating-events-on-day-selection)
Expand Down Expand Up @@ -392,6 +393,25 @@ See the [InteractsWithEvents](https://github.com/saade/filament-fullcalendar/blo

<br>

# Render Hooks

If you want to customize the calendar's event rendering, you can use Fullcalendar's built in [Render Hooks](https://fullcalendar.io/docs/event-render-hooks) for that. All the hooks are supported.

Here's an example of how you can use the `eventDidMount` hook to add a custom implementation:
```php
public function eventDidMount() {
return <<<JS
function({ event, timeText, isStart, isEnd, isMirror, isPast, isFuture, isToday, el, view }){
// Write your custom implementation here
}
JS;
}
```

For another example, see the [Event tooltip on hover](#event-tooltip-on-hover) trick.

<br>

# Tricks

## Editing event after drag and drop
Expand Down Expand Up @@ -423,9 +443,6 @@ You can fill the form with the selected day's date by using the `mountUsing` met

```php
use Saade\FilamentFullCalendar\Actions\CreateAction;
...
...
...

protected function headerActions(): array
{
Expand Down Expand Up @@ -469,13 +486,12 @@ You can add a tooltip to fully show the event title when the user hovers over th
```php
public function eventDidMount() {
return <<<JS
function(info){
info.el.setAttribute("x-tooltip", "tooltip");
info.el.setAttribute("x-data", "{ tooltip: '"+info.event.title+"' }");
function({ event, timeText, isStart, isEnd, isMirror, isPast, isFuture, isToday, el, view }){
el.setAttribute("x-tooltip", "tooltip");
el.setAttribute("x-data", "{ tooltip: '"+event.title+"' }");
}
JS;
}

```

The JavaScript code returned by `eventDidMount()` will be added to [the FullCalendar's `eventDidMount` event render hook](https://fullcalendar.io/docs/event-render-hooks).
Expand Down

0 comments on commit 016fd8d

Please sign in to comment.