Skip to content

Commit ede5c67

Browse files
authored
fix(plugin-seo): thread allowCreate to meta image component (#12624)
<!-- Thank you for the PR! Please go through the checklist below and make sure you've completed all the steps. Please review the [CONTRIBUTING.md](https://github.com/payloadcms/payload/blob/main/CONTRIBUTING.md) document in this repository if you haven't already. The following items will ensure that your PR is handled as smoothly as possible: - PR Title must follow conventional commits format. For example, `feat: my new feature`, `fix(plugin-seo): my fix`. - Minimal description explained as if explained to someone not immediately familiar with the code. - Provide before/after screenshots or code diffs if applicable. - Link any related issues/discussions from GitHub or Discord. - Add review comments if necessary to explain to the reviewer the logic behind a change ### What? ### Why? ### How? Fixes # --> ### What? This PR fixes an issue with `plugin-seo` where the `MetaImageComponent` would not allow creating a new upload document from the field. ### Why? To allow users to upload new media documents for use as a meta image. ### How? Threads `allowCreate` through to the underlying upload input. Fixes #12616 Before: ![image](https://github.com/user-attachments/assets/44ec32c7-1912-4fc3-9b8a-f5deb167320b) After: ![image](https://github.com/user-attachments/assets/0dba1f75-78b6-4472-af38-6178f2ab26ea)
1 parent 684c436 commit ede5c67

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/plugin-seo/src/fields/MetaImage/MetaImageComponent.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ type MetaImageProps = {
2929

3030
export const MetaImageComponent: React.FC<MetaImageProps> = (props) => {
3131
const {
32-
field: { label, localized, relationTo, required },
32+
field: { admin: { allowCreate } = {}, label, localized, relationTo, required },
3333
hasGenerateImageFn,
3434
readOnly,
3535
} = props
@@ -175,6 +175,7 @@ export const MetaImageComponent: React.FC<MetaImageProps> = (props) => {
175175
}}
176176
>
177177
<UploadInput
178+
allowCreate={allowCreate !== false}
178179
api={api}
179180
collection={collection}
180181
Error={Error}

0 commit comments

Comments
 (0)