studiocms
Version:
Astro Native CMS for AstroDB. Built from the ground up by the Astro community.
30 lines (29 loc) • 956 B
JavaScript
import pluginsList from "studiocms:plugins";
import { runSDK, SDKCoreJs } from "studiocms:sdk";
const { data: folderList } = await runSDK(SDKCoreJs.GET.folderList());
const parentFolders = folderList.map(({ id: value, name: label }) => ({ value, label }));
const parentFolderOptions = [{ value: "null", label: "None" }, ...parentFolders];
const pageTypeOptions = pluginsList.flatMap(({ pageTypes }) => {
const pageTypeOutput = [];
if (!pageTypes) {
return pageTypeOutput;
}
for (const { label, identifier } of pageTypes) {
pageTypeOutput.push({ label, value: identifier });
}
return pageTypeOutput;
});
const trueFalse = [
{ label: "True", value: "true" },
{ label: "False", value: "false" }
];
const categoriesOptions = [{ label: "None", value: "null" }];
const tagsOptions = [{ label: "None", value: "null" }];
export {
categoriesOptions,
pageTypeOptions,
parentFolderOptions,
parentFolders,
tagsOptions,
trueFalse
};