Using a MixinΒΆ

Now it is time to use the mixin in a content type. Below is the previous Person content type, modified to include an address. The mixin line as at the bottom.

<content-type>
  <display-name>Person</display-name>
  <super-type>system:structured</super-type>
  <is-abstract>false</is-abstract>
  <is-final>true</is-final>
  <is-built-in>false</is-built-in>
  <allow-child-content>true</allow-child-content>
  <form>
    <field-set name="basic">
      <label>Person info</label>
      <items>
        <input type="TextLine" name="first-name">
          <label>First name</label>
          <immutable>false</immutable>
          <indexed>true</indexed>
          <occurrences minimum="1" maximum="1"/>
        </input>
        <input type="TextLine" name="last-name">
          <label>Last name</label>
          <immutable>false</immutable>
          <indexed>true</indexed>
          <occurrences minimum="1" maximum="1"/>
        </input>
        <input type="ImageSelector" name="image">
          <label>Photo</label>
          <immutable>false</immutable>
          <indexed>false</indexed>
          <occurrences minimum="1" maximum="1"/>
        </input>
        <input type="TextArea" name="bio">
          <label>Bio</label>
          <immutable>false</immutable>
          <indexed>true</indexed>
          <occurrences minimum="0" maximum="1"/>
        </input>
      </items>
    </field-set>
    <x-data mixin="us-address"/>
  </form>
</content-type>

Now you can edit a Person content and see the new address fields.

../../_images/person-address.png