Skip to main content

GeneralTypes

Fetch the system-wide entity types that classify your pages, forms, blocks, and products.

More information about the module's user interface: https://doc.oneentry.cloud/docs/attributes/types/#General-Type-Attributes (opens in a new tab)


The GeneralTypes module returns the system-wide entity types that define the categories of content in your OneEntry project: page types, form types, block types and product types. OneEntry classifies every entity with a fixed set of system types (BlockType): pages (common_page, catalog_page, external_page, error_page), forms (form), blocks (common_block, product_block, slider_block, …) and products (product, service).

The module is read-only. Types are a fixed set defined by the platform; you can't create, change or delete them. getAllTypes() returns the types available in your project.

Quickstart​

Initialize the module from defineOneEntry:


const { } = defineOneEntry(
, {
}
);

Fetch all types:

// Returns a combined list of types across all entities.
const types = await GeneralTypes.getAllTypes();
if ('statusCode' in types) throw new Error(types.message);
// e.g. [{ id: 1, type: "product" }, { id: 17, type: "common_page" }, ...]

// Keep only page types.
const pageTypes = types.filter((t) => t.type.endsWith("_page"));

console.log(pageTypes);

getAllTypes() returns one combined list of types across pages, forms, blocks, products and other entities. There is no built-in filter by entity, so filter the result yourself, as above.

Types by entity​

EntityExample Types (BlockType)Purpose
Pagescommon_page, catalog_page, external_page, error_pageDefine page layouts and functionality
FormsformCategorize form purposes
Blockscommon_block, product_block, slider_blockBuilding blocks for pages/products
Productsproduct, serviceClassify product inventory

Each item returned by getAllTypes() is an IGeneralTypesEntity:

interface IGeneralTypesEntity {
id: number; // Unique numeric ID (e.g. 1, 2, 3)
type: BlockType; // Type name (e.g. "product", "common_page", "form")
}

Type, marker and ID​

IdentifierWhat It IsExampleBest For
TypeCategory/classification of entity"catalog_page"Filtering and grouping
MarkerUnique human-readable identifier"my_about_page"Fetching specific entities
IDNumeric database identifier42Internal system use

Use the type string in your code logic (e.g. if (page.type === 'catalog_page')): it is stable across environments, while id can differ between projects. Fetch the list instead of hardcoding it, and render a fallback for types you don't recognize. Types rarely change, so the list is safe to cache.

Methods​

MethodDescriptionUse Case
getAllTypes()Retrieves all general types in the systemPopulate dropdowns, validate types