Weblösungen mit Plone, Python, React und Svelte

Analysieren, Konzipieren, Implementieren. Kontaktieren.

Gigantic Header Image
Add controls for a single listing block variation.

Add controls for a single listing block variation.

Make the summary variation of the listing and search block more flexible by enhancing the schema and overriding the template

Example: Add fieldset 'columns' with field 'number_of_columns' for variation 'summary'
 
let index_of_summary = blocksConfig.listing.variations.findIndex(
  (obj) => obj.id === 'summary',
);
blocksConfig.listing.variations[index_of_summary].schemaEnhancer = ({
  formData,
  schema,
  intl,
}) => {
  schema.properties.number_of_columns = {
    type: 'number',
    title: 'Number of columns',
  };
  schema.fieldsets.push({
    id: 'columns',
    title: 'Columns',
    fields: ['number_of_columns'],
  });
  return schema;
};
 
schemaenhancer_variation_listing.png
 
If you now override the template of the 'summary' variation with a component that takes the value of 'number_of_columns' into account, then your variation displays in multiple columns, depending on the choice of the number of columns.
 
This affects also the search block, as its variations are the listing block variations.
Neuen Kommentar hinzufügen

Sie können einen Kommentar abgeben, indem Sie das unten stehende Formular ausfüllen. Nur Text. Web- und E-Mail-Adressen werden in anklickbare Links umgewandelt. Kommentare werden moderiert.

Frage: 3 * 4 ?
Ergebnis: