-
Notifications
You must be signed in to change notification settings - Fork 327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comment api #745
base: main
Are you sure you want to change the base?
Comment api #745
Conversation
❌ Deploy Preview for moodledevdocs failed.Built without sensitive environment variables
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few minor changes and we can land this. I'm sure we'll improve the docs in future. This API is long overdue a complete rewrite. It's a horrific API to work with!
@@ -97,6 +97,9 @@ Coding: | |||
Coding_style: | |||
- filePath: "/general/development/policies/codingstyle/index.md" | |||
slug: "/general/development/policies/codingstyle" | |||
Comment_API: | |||
- filePath: "/docs/apis/core/comment/index.md" | |||
slug: "/docs/apis/core/comment/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Slugs don't have a trailing /
slug: "/docs/apis/core/comment/" | |
slug: "/docs/apis/core/comment" |
@@ -90,7 +90,7 @@ The [Check API](./apis/subsystems/check/index.md) allows you to add security, pe | |||
|
|||
### Comment API (comment) | |||
|
|||
The [Comment API](https://docs.moodle.org/dev/Comment_API) allows you to save and retrieve user comments, so that you can easily add commenting to any of your code. | |||
The [Comment API](./api/core/comment) allows you to save and retrieve user comments, so that you can easily add commenting to any of your code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Relative links should be to a file, and this should link to apis
not api
.
The [Comment API](./api/core/comment) allows you to save and retrieve user comments, so that you can easily add commenting to any of your code. | |
The [Comment API](./apis/core/comment/index.md) allows you to save and retrieve user comments, so that you can easily add commenting to any of your code. |
```php | ||
$cmt = new stdclass; | ||
$cmt->contextid = $modcontext->id; | ||
$cmt->area = 'format_post'; | ||
$cmt->itemid = $post->id; | ||
$options->comments = $cmt; | ||
echo format_text($post->message, $post->messageformat, $options, $course->id)."<hr />"; | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When migrating docs, we try to update to meet current coding style:
```php | |
$cmt = new stdclass; | |
$cmt->contextid = $modcontext->id; | |
$cmt->area = 'format_post'; | |
$cmt->itemid = $post->id; | |
$options->comments = $cmt; | |
echo format_text($post->message, $post->messageformat, $options, $course->id)."<hr />"; | |
``` | |
```php | |
$cmt = new stdClass(); | |
$cmt->contextid = $modcontext->id; | |
$cmt->area = 'format_post'; | |
$cmt->itemid = $post->id; | |
$options->comments = $cmt; | |
echo format_text($post->message, $post->messageformat, $options, $course->id) . "<hr />"; |
$options->area = 'database_entry'; | ||
$options->context = $context; | ||
$options->itemid = $record->id; | ||
$options->component = 'mod_data'; | ||
$options->showcount = true; | ||
$comment = new comment($options); | ||
$comment->output(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$options->area = 'database_entry'; | |
$options->context = $context; | |
$options->itemid = $record->id; | |
$options->component = 'mod_data'; | |
$options->showcount = true; | |
$comment = new comment($options); | |
$comment->output(false); | |
$options->area = 'database_entry'; | |
$options->context = $context; | |
$options->itemid = $record->id; | |
$options->component = 'mod_data'; | |
$options->showcount = true; | |
$comment = new comment($options); | |
$comment->output(false); |
HI @crnfpp! |
No description provided.