Replies: 2 comments
-
|
Not at the moment but you're always welcome to PR such a thing! |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Hello ! namespace Spatie\IcalendarGenerator\Components;
use Spatie\IcalendarGenerator\Components\Event;
use Spatie\IcalendarGenerator\ComponentPayload;
use Spatie\IcalendarGenerator\Properties\TextProperty;
class CustomEvent extends Event
{
public static function create(string $name = null): CustomEvent
{
return new self($name);
}
public ?string $descriptionHtml = null;
public ?array $categories = null;
public function descriptionHtml(string $descriptionHtml): CustomEvent
{
$this->descriptionHtml = $descriptionHtml;
return $this;
}
public function categories(array $categories): CustomEvent
{
$this->categories = $categories;
return $this;
}
protected function payload(): ComponentPayload
{
$payload = parent::payload();
$this->resolveCustomProperties($payload);
return $payload;
}
private function resolveCustomProperties(ComponentPayload $payload): self
{
$payload
->optional(
$this->descriptionHtml,
fn () => TextProperty::create('X-ALT-DESC;FMTTYPE=TEXT/HTML', $this->descriptionHtml)
)
->optional(
$this->categories,
fn () => TextProperty::create('CATEGORIES', implode(", ", $this->categories))->withoutEscaping()
);
return $this;
}
}in main file : require_once 'pathToFile/CustomEvent.php';
use Spatie\IcalendarGenerator\Components\CustomEvent;and use : $calendarEvent = new CustomEvent($subject);
$calendarEvent
->descriptionHtml($html)
->categories($ArrayOfStrings); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
I would like to know if there a way to add Categories to an event?
https://www.kanzaki.com/docs/ical/categories.html
I didn't find any clue about this.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions