Skip to content

Commit

Permalink
Add options
Browse files Browse the repository at this point in the history
  • Loading branch information
thecalcc committed Dec 20, 2024
1 parent a5663fa commit aa21445
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {getPlanningProfileFields} from '../profile-fields';
import {IFieldDefinition} from '../field-definitions/interfaces';

export const getCustomVocabularyFields = () => {
const customVocabularyIds = getPlanningProfileFields()
const customVocabularyIds = getPlanningProfileFields({embeddedOnly: true})
.filter((x) => x.type === 'custom_vocabulary')
.map(({vocabularyId}) => vocabularyId);
const result: Array<IFieldDefinition> = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ const unimplementedFields = new Set<string>([

/**
* A function that handles planning profile field types so they can be used in authoring react.
* @embeddedOnly defaults to false
*/
export const getPlanningProfileFields = (): Array<IFieldConverted> => {
export const getPlanningProfileFields = (options: {embeddedOnly?: boolean}): Array<IFieldConverted> => {
const planningProfile = planningApi.contentProfiles.get('planning');
const planningGroups = getEditorFormGroupsFromProfile(planningProfile);
const planningFieldIds = Object.values(planningGroups)
Expand All @@ -39,7 +40,7 @@ export const getPlanningProfileFields = (): Array<IFieldConverted> => {
* If a field does not have show_in_embedded_editor or required toggled on
* we must not show it in the embedded editor
*/
if (!(fieldSchema.show_in_embedded_editor || fieldSchema.required)) {
if (options.embeddedOnly && !(fieldSchema.show_in_embedded_editor || fieldSchema.required)) {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion client/components/planning-editor-standalone/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {getPlanningProfileFields} from './profile-fields';
import {getFieldDefinitions} from './field-definitions/index';

export function getProfile() {
const planningFieldIds = getPlanningProfileFields();
const planningFieldIds = getPlanningProfileFields({embeddedOnly: true});
const skipped = new Set<string>();
const fieldDefinitions = getFieldDefinitions();
const profileV2: IContentProfileV2 = {
Expand Down

0 comments on commit aa21445

Please sign in to comment.