Practical example: Creating a Slideshow component in Castorcito

Objective


Create a custom component called Slideshow that allows the end user to upload multiple images, each with its own title and description, and render them as a carousel on the frontend.


Implementation


For this example, two components will be created:

  • slideshow: Main container component.
  • slide_item: Reusable subcomponent that represents each slide in the carousel.


Create the slide_item component (Slide item)


This component will represent each slide in the carousel.

  1. Access the Castorcito menu in the Drupal administration bar.

    navigation

     

  2. Click Components, then click the Add Component button.

    components

     

    add component

     

  3. Complete the fields for the new component:
    1. Label: Slide item
    2. System name: slide_item
    3. Category: Taylored
    4. Help text: Allows you to add an image with text to display in a carousel.
      1. Check “This component is only for use inside a container, hidden in Drupal field widget.”: Checked
      2. Click on the “Create new component” button.

        add slide item component

         

  4. a