Giter Club home page Giter Club logo

magento2-prismicio-sample-data's Introduction

magento2-prismicio-sample-data

Magento 2 Prismic Sample Data

Exampple of real world example

The prismic json for a landing page custom type. The type has a number of multifunctional slices, and some elements in the main zone.

{
  "Main" : {
    "uid" : {
      "type" : "UID",
      "config" : {
        "label" : "UID"
      }
    },
    "title" : {
      "type" : "StructuredText",
      "config" : {
        "single" : "heading1,heading2,heading3,heading4,heading5,heading6",
        "label" : "Title"
      }
    },
    "description" : {
      "type" : "StructuredText",
      "config" : {
        "multi" : "paragraph,preformatted,heading1,strong,em,hyperlink,image,embed,list-item,o-list-item",
        "allowTargetBlank" : true,
        "label" : "Description"
      }
    },
    "body" : {
      "type" : "Slices",
      "fieldset" : "Slice zone",
      "config" : {
        "labels" : null,
        "choices" : {
          "text_block" : {
            "type" : "Slice",
            "fieldset" : "Text Block",
            "description" : "Description",
            "icon" : "adb",
            "display" : "list",
            "non-repeat" : {
              "content" : {
                "type" : "StructuredText",
                "config" : {
                  "multi" : "paragraph,preformatted,heading1,heading2,heading3,heading4,heading5,heading6,strong,em,hyperlink,embed,list-item,o-list-item",
                  "label" : "Text",
                  "placeholder" : "Content"
                }
              },
              "center" : {
                "type" : "Boolean",
                "config" : {
                  "default_value" : false,
                  "label" : "Center Text"
                }
              },
              "link_title" : {
                "type" : "StructuredText",
                "config" : {
                  "single" : "strong,em",
                  "label" : "Link Title"
                }
              },
              "link" : {
                "type" : "Link",
                "config" : {
                  "label" : "Link",
                  "select" : null
                }
              }
            },
            "repeat" : { }
          },
          "full_width_image" : {
            "type" : "Slice",
            "fieldset" : "Full Width Image",
            "description" : "Banner 100% width",
            "icon" : "image",
            "display" : "list",
            "non-repeat" : {
              "full_width_image" : {
                "type" : "Image",
                "config" : {
                  "constraint" : { },
                  "thumbnails" : [ {
                    "name" : "mobile",
                    "width" : 640,
                    "height" : 320
                  } ],
                  "label" : "Full width Image"
                }
              },
              "full_width_image_url" : {
                "type" : "Link",
                "config" : {
                  "label" : "URL",
                  "placeholder" : "https://{{relative}}",
                  "select" : null
                }
              }
            },
            "repeat" : { }
          },
          "list_items_with_image" : {
            "type" : "Slice",
            "fieldset" : "List Items With Image",
            "description" : "Items with image",
            "icon" : "art_track",
            "display" : "list",
            "non-repeat" : {
              "header" : {
                "type" : "StructuredText",
                "config" : {
                  "single" : "paragraph,strong,em",
                  "label" : "Header"
                }
              },
              "image" : {
                "type" : "Image",
                "config" : {
                  "constraint" : {
                    "width" : 262,
                    "height" : 262
                  },
                  "thumbnails" : [ ],
                  "label" : "Image"
                }
              }
            },
            "repeat" : {
              "icon" : {
                "type" : "StructuredText",
                "config" : {
                  "single" : "rtl",
                  "label" : "Icon"
                }
              },
              "label" : {
                "type" : "StructuredText",
                "config" : {
                  "single" : "paragraph,strong,em,hyperlink",
                  "label" : "Label"
                }
              }
            }
          },
          "large_image_with_text" : {
            "type" : "Slice",
            "fieldset" : "Large Image with text",
            "description" : "Image with text",
            "icon" : "aspect_ratio",
            "display" : "list",
            "non-repeat" : {
              "image" : {
                "type" : "Image",
                "config" : {
                  "constraint" : {
                    "width" : 825,
                    "height" : 652
                  },
                  "thumbnails" : [ {
                    "name" : "mobile",
                    "width" : 640,
                    "height" : 320
                  } ],
                  "label" : "Image"
                }
              },
              "image_url" : {
                "type" : "Link",
                "config" : {
                  "label" : "Image Url",
                  "select" : null
                }
              },
              "content" : {
                "type" : "StructuredText",
                "config" : {
                  "single" : "paragraph,heading2,heading3,heading4,heading5,heading6,strong,em,hyperlink",
                  "label" : "Content"
                }
              }
            },
            "repeat" : { }
          },
        }
      }
    }
  },
  "SEO" : {
    "meta_title" : {
      "type" : "Text",
      "config" : {
        "label" : "Meta title"
      }
    },
    "meta_description" : {
      "type" : "Text",
      "config" : {
        "label" : "Meta description"
      }
    },
    "body2" : {
      "type" : "Slices",
      "fieldset" : "Slice zone",
      "config" : {
        "labels" : { },
        "choices" : { }
      }
    }
  }
}

This example prismic custom type is configured using the view/frontend/layout/prismicio_by_type_landing_page.xml file. Herein a number of slice types are configured that are a part of the prismic json here above. The slices need to be added to the xml using an update element, <update handle="prismicio_slices_text_block"/>. They then also need to be placed inside the prismicio_content element using the move element; <move element="text_block" destination="prismicio_landingpage.slices" as="prismicio_landingpage.slices.text_block" />.

The different slices of this custom type are configured using the view/frontend/layout/prismicio_slices_slice_type.xml files.

XML file naming priscimio_by_type_..., prismicio_slices_...

Using an xml file named prismicio_by_type_custome_type.xml, where 'custom_type' is replaced by the type in question. This will target that prismic custom type.

Similarly, files named prismicio_slices_slice_name.xml, where 'slice_name' is the name of the slice. Will target the slice with that name.

magento2-prismicio-sample-data's People

Contributors

jeroenboersma avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.