# Course Filter

How it works?

Based on Moodle Custom Course Fields and JS. It based on default moodle course page, but extend it to simple course filter. URL: /course/

### 1. Add a Course custom fields

Define additional fields that can be used for filtering courses. This allows for a more tailored search experience based on user-defined parameters.

{% hint style="info" %}
**Site administration → Courses → Course custom fields**\
You can choose from several field types: checkbox, dropdown menu, number, short text, or textarea.
{% endhint %}

<figure><img src="/files/LHiFjf1zxRsidiytNfLY" alt=""><figcaption></figcaption></figure>

***

#### [Multi-language support - Moodle Doc](https://docs.moodle.org/500/en/Multi-language_content_filter) <a href="#multi-language-support" id="multi-language-support"></a>

**Example:**\
It's important not to use line breaks (Enter) between each translation.

<figure><img src="https://rosea.gitbook.io/~gitbook/image?url=https%3A%2F%2F2303389692-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FFXzbdpVhyxdIy0lIThMp%252Fuploads%252FsLpiB8B5L55y6MFKHprA%252F5700369709.png%3Falt%3Dmedia%26token%3De5b2f239-cc05-44a1-bf2e-c97a33769eba&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=1a79444d&#x26;sv=2" alt=""><figcaption></figcaption></figure>

### **2. Add a Custom Field to the Filter**

Go to **XY → Course Filter** and enter your custom field name.

<figure><img src="/files/FQj5QXfGiVmJueB9q1iK" alt=""><figcaption></figcaption></figure>

1. Enable Filter #1
2. Add course custom field shortanem
3. Save


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://rosea.gitbook.io/xy-moodle-theme/course-filter.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
