Building Blocks: Creating a custom sorted list of people for your directory

Stone figures arrayed in a pyramid shape, the single red one at the front, followed by a half dozen yellow figures, and then the remaining base in blue.
Arrange your directory to accurately reflect the organization of your departmental leadership.

The ability to have fine-tuned lists of people within a specific person Type category has been a long-sought request from the SiteFarm user community. We had hoped to find a Drupal community module capable of offering the kind of secure, stable functionality that would meld well with the SiteFarm platform, but the module candidates we've considered are either not ready yet or present user-interface challenges or functionality issues that make us reluctant to add them in.

Instead, we've hit on a solution we hope will work well for you since it utilizes existing features in SiteFarm. We're going to show you how you can create a custom Person List block in the same mold as the other custom blocks available to you in the Custom Block Library. This means:

  • the block will appear in the Custom Block Library list just as the Marketing Highlight block and other blocks do
  • you'll be able to create more than one instance OR reuse a single block created from the Person List block in multiple
  • the same permissions set for the other blocks will apply to this one and Editors will be able to create, edit, place, and delete them as usual
Caveats for this project
  • You must have the Site Builder role in order to create this block, though once created, Site Managers and Editors will be able to use it the same way they use other items in the Custom Block Library.
  • If you have more than one site in which you would like to use this block, you will have to create a unique instance on each site
  • The contents of the block—however many people you list—will be visible to Google search and other search engines, but the Search/Filter block normally associated with the People directory will not see them because search/filter is associated with View content (default output), not your new block content.
  • When attached to your /people page, this block will statically live on the page and be independent of the pagination element on the bottom of the page if you have more than ten people in your directory

Create the Person List block (Site Builder role required)

  1. Navigate to Shortcuts » Blocks » Custom Block Library tab » Block Types tab.
    Location of the custom block tab.
  2. Click the + Add custom block type button.
  3. Provide a label: Person List
  4. Provide a description: A custom list of people content you can drag 'n' drop into your preferred order
  5. Click Save to finish, after which the system will return you to the Custom block types list.
Setting the Fields
  1. Locate Person List and click its Manage Fields button.
  2. By default, the block comes with a Body field. Use the Operations button to delete the Body field.
  3. When the system asks you to confirm the deletion, click the Delete button to continue.
  4. When you return to the Manage Fields screen, click the + Add fields button.
  5. On the Add Field screen, use the menu under Add a new field to select Reference: Content.
    Select Reference: Content from the field list.
  6. A label field will appear. Type in "Person" and then click the Save and continue button.
  7. The new Person screen will appear. Change the Allowed number of values from Limited: 1, to Unlimited.
  8. Click the Save field button.
  9. On the Person settings for Person List page, scroll to the bottom and locate the Reference type » Content type section. Check the box for the Person content type.
  10. Click the Save settings button.
Manage form display tab
  1. On the Manage form display page use the pull handle on the left side to drag the Person field listing underneath the Block description field.
  2. Click Save to finish.
Manage display tab
  1. On the Manage display page, update the Person field display settings to:
    1. Label: from Above to - Visually hidden -
    2. Format: from Label to Rendered entity
    3. Cogwheel
      1. View mode: from Default to Teaser
      2. Click the Update button
  2. Click the Save button to finish.
  3. Your block is now created, configured, and ready for use.

Use your new Person List block

  1. Whichever people are going to be added to your specific person list, you should first edit these pages and, under Additional Options » Promotion Options, check the box to Hide from Directory to avoid having the person show up twice on your page.
  2. You can either create the block through the Custom Block Library path or use the Place block button option.
  3. From your Custom Block Library, select the Person List block from the list.
  4. Provide the following information:
    1. Block description (title) - this will be the Person type group you would have assigned your people
    2. People's names as entered previously in a Person content type. Each field will autocomplete the name to assist you in your selection
    3. Continue to use the Add another item button until you have enough fields to add the select group of people you need to manually organize
    4. If necessary, use the pull handles on the left side to drag 'n' drop the names into the order you want them to display on the page
      The user interface screen for adding a block description and the fields for your individual people.
      Use the pull handles on the left to drag 'n' drop the people into your preferred order.
  5. Click Save to continue.
  6. On the Configure block page, scroll down and locate the Visibility | Pages field. Enter in /people so the block will appear on the correct page.
  7. Assign the correct region. Please note that if you add it to the Content region, you may need to adjust the block's position in the Block Layout page if you want it to appear over top of the default people listing.
  8. Click Save block to finish and review your work.

Example of Final Output

The custom Person list block listed above the default people directory. In the image on the left, you'll see an example of a People directory that includes a custom Person List block titled "Executive Group." Without this block, the three people included would have been included in the original, default directory, but in alphabetical order by last name instead of in our preferred order with the Executive Director, Regina Tyson, listed first. Likewise, we can say in our scenario that Sara Knowles has seniority in the Assistant Director position and we want her listed next followed by Dennis Jones.

The remainder of the regular listing follows after, denoted by the visual break between our Executive Group block (custom Person List block) and the beginning of the section for Principal Investigators from the regular People directory that comes standard in your SiteFarm site.

Category

Tags