Calendar Object from Page

Permalink Browser Info Environment
Could this be customized to include an Event Attribute from the page that the form is located on?

Type: Ticket
Status: Resolved
dfirm
View Replies:
mnakalay replied on at Permalink Reply
mnakalay
Yes absolutely. You can create your own data source and use it with the plugin.

By using the included current page data source as an example you can modify it to grab the attribute from the page instead of just the page.

Here's an example package to show you how to create your own custom data:https://github.com/mnakalay/kalmoya_test_dynamic_source...
dfirm replied on at Permalink Reply
dfirm
Thanks for the fast reply!

I downloaded the package you sent me, and began to modify it.

When I went to install it, I get this error "Unable to install Hidden Attributes Calendar. Please check that this package has been updated for 5.7."
mnakalay replied on at Permalink Reply
mnakalay
What version of concrete5 are you using? The minimum version required is 8.2.1
And you also must install the main Hidden Attribute Package first
dfirm replied on at Permalink Reply 1 Attachment
dfirm
8.5.2

I have attached the revised package in case you want to take a look.
mnakalay replied on at Permalink Reply 1 Attachment
mnakalay
You had a few issues with the code. I corrected it for you, it should work now.

I'm attaching the new version to this message
dfirm replied on at Permalink Reply
dfirm
Thank you for that. Installed perfectly.

Now to another issue that is not really related to your add-on but I can not find any documentation or forum posts about. If you wouldn't mind to point me in the right direction.

How do I access the info about the event? I know how to get custom attributes I have created for the event, but I can not figure out how to get the basic event info, e.g. Title, start time, description, topic.
mnakalay replied on at Permalink Reply
mnakalay
I am not 100% sure but I think you'd do something like this. Once you have your event $event_att you can get the title and description like this:
$event = $event_att->getSelectedVersion();
$title = $event->getName();
$description = $event->getDescription();
$topics = $event->getCategories();


While start and end times are relative to occurrences so you'd do it like this:

$eventOccurrences = $event_att->getOccurrences();
if (is_array($eventOccurrences)) {
    foreach($eventOccurrences as $occurrence) {
        $startTime = $occurrence->getStart();
        $endTime = $occurrence->getEnd();
        // do something with it
    }
}


I'm afraid none of this is tested but there's a reasonable chance it'll work :)
dfirm replied on at Permalink Reply
dfirm
That's exactly what I was looking for. Thank you so much!
mnakalay replied on at Permalink Reply
mnakalay
Glad I could help :)

If you find the package useful, it would really mean a lot if you could leave a review for it.

If you have time, you can do it here:https://marketplace.concretecms.com/marketplace/addons/hidden-data-a...

Thank you.

concrete5 Environment Information

-

Browser User-Agent String

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You may not request a refund that is not currently owned by you.