Skip to content

Commit 81d0a5b

Browse files
committed
Fixed matrix fields #5
- Fixed issues with fields inside of matrix fields. - Fixed bug occuring upon creation of new fields.
1 parent fa7b146 commit 81d0a5b

File tree

2 files changed

+40
-6
lines changed

2 files changed

+40
-6
lines changed

CHANGELOG.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
11
# Release Notes for chatgpt-integration
22

3+
## 1.0.4 - 2023-09-26
4+
### Added
5+
- Added the option to enable or disable individual fields inside matrix fields.
6+
7+
### Fixed
8+
- Fixed an issue where an error could occur upon creating new fields. (#5)
9+
310
## 1.0.3 - 2023-04-27
411
> {warning} Once you have installed the update, you need to head to the settings page and select which fields the prompts should be displayed for.
512
613
### Added
714
- Added the option to enable or disable individual fields in the settings.
815
- Added the option to disable the default translation prompts.
9-
- Added warning when saving settings without an api token
16+
- Added warning when saving settings without an api token.
1017

1118
### Changed
12-
- Divided settings over three sup-pages for clarity
19+
- Divided settings over three sup-pages for clarity.
1320

1421
## 1.0.2 - 2023-04-04
1522

src/templates/settings/fields.twig

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,40 @@
3939
<td class="group-column">{{ craft.chatgptIntegration.getClass(field) }}</td>
4040
<td class="group-column">{{ field.group }}</td>
4141
<td class="enabled-column">
42-
{{ forms.lightswitch({
43-
name: 'enabledFields['~field.id~'].key',
44-
on: settings.enabledFields|length and settings.enabledFields[field.id]
45-
}) }}
42+
{% if craft.chatgptIntegration.getClass(field) != "craft\\fields\\Matrix" %}
43+
{{ forms.lightswitch({
44+
name: 'enabledFields['~field.id~'].key',
45+
on: settings.enabledFields|length and settings.enabledFields[field.id] is defined and settings.enabledFields[field.id]
46+
}) }}
47+
{% endif %}
4648
</td>
4749
</tr>
4850
</tbody>
51+
52+
{% if craft.chatgptIntegration.getClass(field) == "craft\\fields\\Matrix" %}
53+
{% for block in field.getBlockTypes() %}
54+
{% for matrixField in block.customFields %}
55+
<tbody>
56+
<tr class="s-{{ matrixField.id }}">
57+
<td class="label-column" style="text-indent: 2em;">{{ block.name }}: {{ matrixField.name }}</td>
58+
<td class="handle-column">
59+
<div id="fields-handle-attribute" class="code small light copytextbtn" title="Copy to clipboard" role="button" aria-label="Copy to clipboard" tabindex="0" onclick="navigator.clipboard.writeText('{{ matrixField.handle }}')">
60+
<input type="text" value="{{ matrixField.handle }}" readonly="" size="{{ matrixField.handle|length }}" tabindex="-1">
61+
<span data-icon="clipboard" aria-hidden="true"></span>
62+
</div></td>
63+
<td class="group-column">{{ craft.chatgptIntegration.getClass(matrixField) }}</td>
64+
<td class="group-column">{{ matrixField.group ?? field.group }}</td>
65+
<td class="enabled-column">
66+
{{ forms.lightswitch({
67+
name: 'enabledFields['~matrixField.id~'].key',
68+
on: settings.enabledFields|length and settings.enabledFields[matrixField.id] is defined and settings.enabledFields[matrixField.id]
69+
}) }}
70+
</td>
71+
</tr>
72+
</tbody>
73+
{% endfor %}
74+
{% endfor %}
75+
{% endif %}
4976
{% endfor %}
5077
</table>
5178
</div>

0 commit comments

Comments
 (0)