Example - List Picker

In Example - RSS Feed we used the Multi Selector content source to extract a subset of the feed data, then filtered and shuffled it down to just the data we wanted to display using the Multi Level List content display.

The List Picker content display provides an alternative way of getting to the same kind of result. Rather than extracting a bit more than what we need with Multi Selector  content transform and then filtering out what we don't need in the Multi Level List content display , we make all the data available to the display as a 2-dimensional list via the List Selector content transform and then pick the few items we actually want from that in the List Picker content display.

For some types of data and display, its easier to filter out what isn't wanted. For some types of data and sisplay, its easier to pick only what is wanted. In may cases, its a matter of personal preference as to what you are most comfortable working with.

In Detail

The content source is URL configured exactly the same as previously. In the List Selector content transform, the source content type is 'XML / XHTML', the outer selector is 'channel' and the item selector is 'item'. So far, very similar to our previous use of Multi Selector. However, we don't want to end our data there, so at the bottom of the transform we select to Flatten to list with.dot.notation within each item

Rather than go straight to the display, first have a quick look at the data available using the Serialize content display. This is generally a useful intermediary stage when viewing complex data and becomes essential with List Picker because we need to know the keys to pick from.

To avoid cluttering the page, in the below the data has been sliced to just the first item.

Array
(
    [0] => Array
        (
            [item.title] => NASA Astronaut Aboard Space Station to Answer Girl Scouts’ Questions
            [item.link] => http://www.nasa.gov/press-release/nasa-astronaut-aboard-space-station-to-answer-girl-scouts-questions
            [item.description] => Girl Scouts from across the nation will pose questions next week to NASA astronaut Chris Cassidy aboard the International Space Station.
            [item.enclosure.url] => http://www.nasa.gov/sites/default/files/styles/1x1_cardfeed/public/thumbnails/image/iss063e043823.jpg?itok=JEIzyiPs
            [item.enclosure.length] => 2724788
            [item.enclosure.type] => image/jpeg
            [item.guid.text] => http://www.nasa.gov/press-release/nasa-astronaut-aboard-space-station-to-answer-girl-scouts-questions
            [item.guid.isPermaLink] => false
            [item.pubDate] => Fri, 07 Aug 2020 16:19 EDT
            [item.source.text] => NASA Breaking News
            [item.source.url] => http://www.nasa.gov/rss/dyn/breaking_news.rss
            [item.dc:identifier] => 463456
        )

    [1] => Array
        (
            [item.title] => NASA Awards Contract for Consolidated Information Technology Services
            [item.link] => http://www.nasa.gov/press-release/nasa-awards-contract-for-consolidated-information-technology-services
            [item.description] => NASA has selected ASRC Federal Data Solutions (AFDS) Inc. of Beltsville, Maryland, to receive a contract for Ames Consolidated Information Technology Services at the agency's Ames Research Center in Moffett Field, California.
            [item.enclosure.url] => http://www.nasa.gov/sites/default/files/styles/1x1_cardfeed/public/thumbnails/image/nasa-logo-web-rgb_0.jpg?itok=mrBnB_c9
            [item.enclosure.length] => 189751
            [item.enclosure.type] => image/jpeg
            [item.guid.text] => http://www.nasa.gov/press-release/nasa-awards-contract-for-consolidated-information-technology-services
            [item.guid.isPermaLink] => false
            [item.pubDate] => Fri, 07 Aug 2020 15:21 EDT
            [item.source.text] => NASA Breaking News
            [item.source.url] => http://www.nasa.gov/rss/dyn/breaking_news.rss
            [item.dc:identifier] => 463455
        )

    [2] => Array
        (
            [item.title] => NASA Awards Laboratory Services Contract
            [item.link] => http://www.nasa.gov/press-release/nasa-awards-laboratory-services-contract
            [item.description] => NASA has awarded the Laboratory Services contract (LSC) to Alutiiq Essentials Services LLC of Kodiak, Alaska, to provide laboratory services at NASA’s Stennis Space Center near Bay St. Louis, Mississippi, and NASA’s Michoud Assembly Facility in New Orleans.
            [item.enclosure.url] => http://www.nasa.gov/sites/default/files/styles/1x1_cardfeed/public/thumbnails/image/nasa-logo-web-rgb_0.jpg?itok=mrBnB_c9
            [item.enclosure.length] => 189751
            [item.enclosure.type] => image/jpeg
            [item.guid.text] => http://www.nasa.gov/press-release/nasa-awards-laboratory-services-contract
            [item.guid.isPermaLink] => false
            [item.pubDate] => Fri, 07 Aug 2020 15:06 EDT
            [item.source.text] => NASA Breaking News
            [item.source.url] => http://www.nasa.gov/rss/dyn/breaking_news.rss
            [item.dc:identifier] => 463454
        )

    [3] => Array
        (
            [item.title] => NASA Administrator Statement on the Passing of Mike Freilich
            [item.link] => http://www.nasa.gov/press-release/nasa-administrator-statement-on-the-passing-of-mike-freilich
            [item.description] => Statement from NASA Administrator Jim Bridenstine on the passing of Mike Freilich, passionate explorer and former director of NASA's Earth Science Division.
            [item.enclosure.url] => http://www.nasa.gov/sites/default/files/styles/1x1_cardfeed/public/thumbnails/image/49455708267_72dec3133a_k.jpg?itok=b3180ytE
            [item.enclosure.length] => 625629
            [item.enclosure.type] => image/jpeg
            [item.guid.text] => http://www.nasa.gov/press-release/nasa-administrator-statement-on-the-passing-of-mike-freilich
            [item.guid.isPermaLink] => false
            [item.pubDate] => Wed, 05 Aug 2020 11:20 EDT
            [item.source.text] => NASA Breaking News
            [item.source.url] => http://www.nasa.gov/rss/dyn/breaking_news.rss
            [item.dc:identifier] => 463398
        )

    [4] => Array
        (
            [item.title] => NASA Astronaut Aboard Space Station Answers STEM Students’ Questions
            [item.link] => http://www.nasa.gov/press-release/nasa-astronaut-aboard-space-station-answers-stem-students-questions
            [item.description] => Students participating in Space Station Explorers STEM programs across the nation will pose questions this week to NASA astronaut Chris Cassidy aboard the International Space Station.
            [item.enclosure.url] => http://www.nasa.gov/sites/default/files/styles/1x1_cardfeed/public/thumbnails/image/iss063e040639.jpg?itok=WmM9ZAsf
            [item.enclosure.length] => 2263011
            [item.enclosure.type] => image/jpeg
            [item.guid.text] => http://www.nasa.gov/press-release/nasa-astronaut-aboard-space-station-answers-stem-students-questions
            [item.guid.isPermaLink] => false
            [item.pubDate] => Wed, 05 Aug 2020 10:00 EDT
            [item.source.text] => NASA Breaking News
            [item.source.url] => http://www.nasa.gov/rss/dyn/breaking_news.rss
            [item.dc:identifier] => 463381
        )

    [5] => Array
        (
            [item.title] => NASA Astronauts to Discuss Historic SpaceX Crew Dragon Test Flight
            [item.link] => http://www.nasa.gov/press-release/nasa-astronauts-to-discuss-historic-spacex-crew-dragon-test-flight
            [item.description] => NASA astronauts Robert Behnken and Douglas Hurley will discuss their recently completed SpaceX Demo-2 test flight mission to the International Space Station during a news conference at 4:30 p.m. EDT Tuesday, Aug. 4.
            [item.enclosure.url] => http://www.nasa.gov/sites/default/files/styles/1x1_cardfeed/public/thumbnails/image/50182385066_d1ff8f191c_k_0.jpg?itok=sRRo7-yf
            [item.enclosure.length] => 602754
            [item.enclosure.type] => image/jpeg
            [item.guid.text] => http://www.nasa.gov/press-release/nasa-astronauts-to-discuss-historic-spacex-crew-dragon-test-flight
            [item.guid.isPermaLink] => false
            [item.pubDate] => Mon, 03 Aug 2020 14:31 EDT
            [item.source.text] => NASA Breaking News
            [item.source.url] => http://www.nasa.gov/rss/dyn/breaking_news.rss
            [item.dc:identifier] => 463319
        )

    [6] => Array
        (
            [item.title] => NASA Astronauts Safely Splash Down after First Commercial Crew Flight to Space Station
            [item.link] => http://www.nasa.gov/press-release/nasa-astronauts-safely-splash-down-after-first-commercial-crew-flight-to-space-station
            [item.description] => Two NASA astronauts splashed down safely in the Gulf of Mexico Sunday for the first time in a commercially built and operated American crew spacecraft, returning from the International Space Station to complete a test flight that marks a new era in human spaceflight.
            [item.enclosure.url] => http://www.nasa.gov/sites/default/files/styles/1x1_cardfeed/public/thumbnails/image/nhq202008020016.jpg?itok=jH6eP0Sy
            [item.enclosure.length] => 1939138
            [item.enclosure.type] => image/jpeg
            [item.guid.text] => http://www.nasa.gov/press-release/nasa-astronauts-safely-splash-down-after-first-commercial-crew-flight-to-space-station
            [item.guid.isPermaLink] => false
            [item.pubDate] => Sun, 02 Aug 2020 16:15 EDT
            [item.source.text] => NASA Breaking News
            [item.source.url] => http://www.nasa.gov/rss/dyn/breaking_news.rss
            [item.dc:identifier] => 463292
        )

    [7] => Array
        (
            [item.title] => NASA Broadcasts First Splashdown of American Astronauts in 45 Years
            [item.link] => http://www.nasa.gov/press-release/nasa-broadcasts-first-splashdown-of-american-astronauts-in-45-years
            [item.description] => NASA is broadcasting the return of the agency’s SpaceX Demo-2 test flight with NASA astronauts Robert Behnken and Douglas Hurley from the International Space Station – the first splashdown of an American crew spacecraft in 45 years.
            [item.enclosure.url] => http://www.nasa.gov/sites/default/files/styles/1x1_cardfeed/public/thumbnails/image/49967417433_9e8c9d279a_k_0.jpg?itok=pVyiDIIF
            [item.enclosure.length] => 674916
            [item.enclosure.type] => image/jpeg
            [item.guid.text] => http://www.nasa.gov/press-release/nasa-broadcasts-first-splashdown-of-american-astronauts-in-45-years
            [item.guid.isPermaLink] => false
            [item.pubDate] => Sun, 02 Aug 2020 13:06 EDT
            [item.source.text] => NASA Breaking News
            [item.source.url] => http://www.nasa.gov/rss/dyn/breaking_news.rss
            [item.dc:identifier] => 463290
        )

    [8] => Array
        (
            [item.title] => NASA Astronauts in Space to Discuss Upcoming SpaceX Crew Dragon Return
            [item.link] => http://www.nasa.gov/press-release/nasa-astronauts-in-space-to-discuss-upcoming-spacex-crew-dragon-return
            [item.description] => NASA astronauts Robert Behnken and Douglas Hurley will address their upcoming SpaceX Crew Dragon departure and splashdown in a news conference at 10:45 a.m. EDT Friday, July 31, from the International Space Station.
            [item.enclosure.url] => http://www.nasa.gov/sites/default/files/styles/1x1_cardfeed/public/thumbnails/image/49968955896_d2df186e3a_k.jpg?itok=yfqW90Z7
            [item.enclosure.length] => 695705
            [item.enclosure.type] => image/jpeg
            [item.guid.text] => http://www.nasa.gov/press-release/nasa-astronauts-in-space-to-discuss-upcoming-spacex-crew-dragon-return
            [item.guid.isPermaLink] => false
            [item.pubDate] => Thu, 30 Jul 2020 15:13 EDT
            [item.source.text] => NASA Breaking News
            [item.source.url] => http://www.nasa.gov/rss/dyn/breaking_news.rss
            [item.dc:identifier] => 463241
        )

    [9] => Array
        (
            [item.title] => NASA, ULA Launch Mars 2020 Perseverance Rover Mission to Red Planet
            [item.link] => http://www.nasa.gov/press-release/nasa-ula-launch-mars-2020-perseverance-rover-mission-to-red-planet
            [item.description] => NASA's Mars 2020 Perseverance rover mission is on its way to the Red Planet to search for signs of ancient life and collect samples to send back to Earth.
            [item.enclosure.url] => http://www.nasa.gov/sites/default/files/styles/1x1_cardfeed/public/thumbnails/image/50169630453_a7335051bf_k.jpg?itok=kRfPHszY
            [item.enclosure.length] => 248868
            [item.enclosure.type] => image/jpeg
            [item.guid.text] => http://www.nasa.gov/press-release/nasa-ula-launch-mars-2020-perseverance-rover-mission-to-red-planet
            [item.guid.isPermaLink] => false
            [item.pubDate] => Thu, 30 Jul 2020 08:56 EDT
            [item.source.text] => NASA Breaking News
            [item.source.url] => http://www.nasa.gov/rss/dyn/breaking_news.rss
            [item.dc:identifier] => 463224
        )

)
View settings

Looking at the data we make note of the keys:

  • item.title
  • item.link
  • item.enclosure.url
  • item.pubDate
  • item.description

We can then use those keys to pick out the data in List Picker. It uses the same Header Extra Content styles to layout and format the feed items. 

A nice trick we can do with List Picker is to assign an item as a link behind another item, so rather than just having the full URL text as a link, we can link to it directly from the title and from the image.

 

NASA Astronaut Aboard Space Station to Answer Girl Scouts’ Questions

Fri, 07 Aug 2020 16:19 EDT

Girl Scouts from across the nation will pose questions next week to NASA astronaut Chris Cassidy aboard the International Space Station.

NASA Awards Contract for Consolidated Information Technology Services

Fri, 07 Aug 2020 15:21 EDT

NASA has selected ASRC Federal Data Solutions (AFDS) Inc. of Beltsville, Maryland, to receive a contract for Ames Consolidated Information Technology Services at the agency's Ames Research Center in Moffett Field, California.

View settings

Settings as JSON

If you haven't already noticed, many of our example Universal Content Puller blocks have a small View settings button to the top right, where you can view the block settings as JSON data and even copy them to paste into your own UCP blocks using using the Import button in the Support tab of the edit dialog.

As a change from also showing screengrabs of some of the settings, for this example we have used the Export button in the Support tab of the block edit dialog to export the settings from the above UCP block and show them below. 

Open the accordion below to view the JSON. You can copy these settings and paste them into your own UCP blocks using the Import button.

Settings as JSON

        [
  {
    "name": "content_source_plugin",
    "value": "URL"
  },
  {
    "name": "ucp_cs_u_r_l_ucp_cs_source_url",
    "value": "https://www.nasa.gov/rss/dyn/breaking_news.rss"
  },
  {
    "name": "ucp_cs_u_r_l_ucp_cs_source_cache_enable",
    "value": "on"
  },
  {
    "name": "ucp_cs_u_r_l_ucp_cs_source_cache_duration",
    "value": "global"
  },
  {
    "name": "ucp_cs_u_r_l_ucp_cs_source_cache_duration_mins",
    "value": "360"
  },
  {
    "name": "content_transform_plugin",
    "value": "List Selector"
  },
  {
    "name": "ucp_ct_list_selector_ucp_ct_qp_obj",
    "value": "qp"
  },
  {
    "name": "ucp_ct_list_selector_ucp_ct_qp_selector",
    "value": "channel"
  },
  {
    "name": "ucp_ct_list_selector_ucp_ct_item_selector",
    "value": "item"
  },
  {
    "name": "ucp_ct_list_selector_ucp_ct_rows_offset",
    "value": "0"
  },
  {
    "name": "ucp_ct_list_selector_ucp_ct_rows_length",
    "value": "10"
  },
  {
    "name": "ucp_ct_list_selector_ucp_ct_flatten",
    "value": "list"
  },
  {
    "name": "content_display_plugin",
    "value": "ListPicker"
  },
  {
    "name": "ucp_cd_list_picker_ucp_cd_list_format[row]",
    "value": "ph3"
  },
  {
    "name": "ucp_cd_list_picker_ucp_cd_list_item_heading[row]",
    "value": "pick"
  },
  {
    "name": "ucp_cd_list_picker_ucp_cd_list_item_user_heading[row]",
    "value": ""
  },
  {
    "name": "ucp_cd_list_picker_ucp_cd_list_item_picked_heading[row]",
    "value": "item.title"
  },
  {
    "name": "ucp_cd_list_picker_ucp_cd_list_item_heading_linked[row]",
    "value": "item.link"
  },
  {
    "name": "ucp_cd_list_picker_ucp_cd_list_item_filter[row]",
    "value": ""
  },
  {
    "name": "ucp_cd_list_picker_ucp_cd_list_item_shuffle[row]",
    "value": ""
  },
  {
    "name": "ucp_cd_list_picker_ucp_cd_list_format[col]",
    "value": "ph4"
  },
  {
    "name": "ucp_cd_list_picker_ucp_cd_list_item_heading[col][0]",
    "value": "none"
  },
  {
    "name": "ucp_cd_list_picker_ucp_cd_list_item_user_heading[col][0]",
    "value": ""
  },
  {
    "name": "ucp_cd_list_picker_ucp_cd_list_item_picked_heading[col][0]",
    "value": ""
  },
  {
    "name": "ucp_cd_list_picker_ucp_cd_list_item_heading_linked[col][0]",
    "value": ""
  },
  {
    "name": "ucp_cd_list_picker_ucp_cd_list_item_picked_value[col][0]",
    "value": "item.enclosure.url"
  },
  {
    "name": "ucp_cd_list_picker_ucp_cd_list_item_value_linked[col][0]",
    "value": "item.link"
  },
  {
    "name": "ucp_cd_list_picker_ucp_cd_list_item_heading[col][1]",
    "value": "none"
  },
  {
    "name": "ucp_cd_list_picker_ucp_cd_list_item_user_heading[col][1]",
    "value": ""
  },
  {
    "name": "ucp_cd_list_picker_ucp_cd_list_item_picked_heading[col][1]",
    "value": ""
  },
  {
    "name": "ucp_cd_list_picker_ucp_cd_list_item_heading_linked[col][1]",
    "value": ""
  },
  {
    "name": "ucp_cd_list_picker_ucp_cd_list_item_picked_value[col][1]",
    "value": "item.pubDate"
  },
  {
    "name": "ucp_cd_list_picker_ucp_cd_list_item_value_linked[col][1]",
    "value": ""
  },
  {
    "name": "ucp_cd_list_picker_ucp_cd_list_item_heading[col][2]",
    "value": "none"
  },
  {
    "name": "ucp_cd_list_picker_ucp_cd_list_item_user_heading[col][2]",
    "value": ""
  },
  {
    "name": "ucp_cd_list_picker_ucp_cd_list_item_picked_heading[col][2]",
    "value": ""
  },
  {
    "name": "ucp_cd_list_picker_ucp_cd_list_item_heading_linked[col][2]",
    "value": ""
  },
  {
    "name": "ucp_cd_list_picker_ucp_cd_list_item_picked_value[col][2]",
    "value": "item.description"
  },
  {
    "name": "ucp_cd_list_picker_ucp_cd_list_item_value_linked[col][2]",
    "value": ""
  },
  {
    "name": "ucp_cd_list_picker_ucp_cd_items_to_display",
    "value": "2"
  },
  {
    "name": "ucp_cd_list_picker_ucp_cd_paginate_if_more",
    "value": "b"
  },
  {
    "name": "ucp_cd_list_picker_ucp_cd_orphan_limit",
    "value": "0"
  },
  {
    "name": "ucp_cd_list_picker_ucp_cd_block_in_pagination",
    "value": ""
  },
  {
    "name": "ucp_cd_list_picker_ucp_cd_striped",
    "value": "striped"
  },
  {
    "name": "ucp_cd_list_picker_ucp_cd_condensed",
    "value": "condensed"
  },
  {
    "name": "ucp_cd_list_picker_ucp_cd_hover",
    "value": "hover"
  },
  {
    "name": "options[ajax_mode]",
    "value": "none"
  },
  {
    "name": "options[ajax_mode_delay]",
    "value": ""
  },
  {
    "name": "options[ajax_mode_proximity]",
    "value": ""
  },
  {
    "name": "options[placeholder_type]",
    "value": "marker"
  },
  {
    "name": "options[placeholder_label]",
    "value": "Loading..."
  },
  {
    "name": "options[placeholder_height]",
    "value": "25"
  },
  {
    "name": "options[placeholder_height_u]",
    "value": "vw"
  },
  {
    "name": "cache_permission",
    "value": "1"
  },
  {
    "name": "options[CacheBlockOutputLifetime]",
    "value": "0"
  },
  {
    "name": "options[sanitize_op]",
    "value": "safe"
  },
  {
    "name": "options[autolink]",
    "value": "youthweb_n"
  },
  {
    "name": "options[image_render]",
    "value": "***image"
  },
  {
    "name": "options[wrapper_enable]",
    "value": "wrap"
  },
  {
    "name": "options[wrapper_element]",
    "value": "div"
  },
  {
    "name": "options[wrapper_class]",
    "value": "ucp-body example-styled"
  },
  {
    "name": "options[edit_mode_marker]",
    "value": ""
  },
  {
    "name": "options[debug]",
    "value": ""
  },
  {
    "name": "options[show_exporter]",
    "value": "show_exporter"
  },
  {
    "name": "whitelabel",
    "value": "off"
  }
]    

Additional Pages

About this Sidebar

Creating a sidebar for a group of pages without messing about with stacks is an easy use-case for Universal Content Puller.

This sidebar is edited once, within the main addon page for Universal Content Puller.

It is then pulled into all UCP sub-pages using a UCP block.

The Content Source is Parent Page, set to pull the Sidebar area from 2 pages from the top. The Content Transform is Selector, set to remove container and row classes that, when unnecessarily nested, could mess up the Bootstrap grid. The Content Display is Plain, which just outputs the transformed text.

In the advanced settings, sanitization is disabled as we trust the source page and don't want to strip out any formatting or functionality from the pulled sidebar.