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
| Entity | Example Types (BlockType) | Purpose |
|---|---|---|
| Pages | common_page, catalog_page, external_page, error_page | Define page layouts and functionality |
| Forms | form | Categorize form purposes |
| Blocks | common_block, product_block, slider_block | Building blocks for pages/products |
| Products | product, service | Classify 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
| Identifier | What It Is | Example | Best For |
|---|---|---|---|
| Type | Category/classification of entity | "catalog_page" | Filtering and grouping |
| Marker | Unique human-readable identifier | "my_about_page" | Fetching specific entities |
| ID | Numeric database identifier | 42 | Internal 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
| Method | Description | Use Case |
|---|---|---|
| getAllTypes() | Retrieves all general types in the system | Populate dropdowns, validate types |
Related
- Pages Module: pages classified by type
- Forms Module: forms classified by type
- Blocks Module: blocks classified by type
- Products Module: products classified by type