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.
Add comment

You can add a comment by filling out the form below. Plain text formatting. Web and email addresses are transformed into clickable links. Comments are moderated.

Question: 100 - 17 ?
Your answer: