Q4Widgets API Documentation

q4.news

Fetches and displays press releases from the Q4 private API.

Below is an example of a news widget with tag filtering.
- It uses the yearSelect and yearTemplate to render a dropdown list of years.
- This widget uses the tagSelect option to allow the user to filter the news releases based on tags.
- Changing the tag with the dropdown will reset the year to the default, as the year list will reload to hide any years without that tag.

Script link
q4.api.1.13.6.min.js
Source file
q4.api.js, line 2137

This widget extends the q4.api widget. It has all the options and methods of the parent widget, in addition to those below. See the parent widget's documentation for details.

Examples

<div class="module_container module_container--widget">
  <div class="module_options">
    <label class="module_options-label" for="newsYear">Select Year: </label>
    <select class="dropdown module_options-select module_options-year" id="newsYear"></select>
    <label class="module_options-label" for="newsCat">Category:</label>
    <select class="dropdown module_options-select news-tags" id="newsCat">
      <option selected="selected" value="">All Press Releases</option>
      <option value="earnings">Earnings</option>
      <option value="dividend">Dividend</option>
      <option value="other">Other</option>
    </select>
  </div>
  <div class="module_container module_container--content"></div>
</div>
<script>
$('.module-news-widget .module_container--widget').news({
  tagSelect: '.news-tags',
  yearSelect: '.module_options-year',
  yearContainer: '.module_options-year',
  yearTemplate: '<option value="{{value}}">{{year}}</option>',
  itemContainer: '.module_container--content',
  itemTemplate: (
    '<div class="module_item">' +
      '<div class="module_item-wrap">' +
        '<div class="module_date-time">' +
          '<span class="module_date-text">{{date}}</span>' +
        '</div>' +
        '<div class="module_headline">' +
          '<a class="module_headline-link" href="{{url}}">{{title}}</a>' +
        '</div>' +
        '<div class="module_attachments attachments">' +
          '{{#attachments}}' +
            '<a class="attachments_item{{#type}} attachments_item--{{type}}{{/type}}" href="{{url}}">' +
            '<span class="attachments_title">{{category}}: {{title}}</span>' +
            '<span class="attachments_sizeType">{{#size}}({{size}} {{extension}}){{/size}}</span>' +
            '</a>' +
          '{{/attachments}} ' +
        '</div>' +
        '<div class="module_media-collection media-collection">' +
          '{{#media}}' +
              '<img class="media-collection_image" alt="{{alt}}" src="{{url}}" />' +
              '<span class="media-collection_info">{{alt}} ({{width}} x {{height}}) {{type}}</span>' +
          '{{/media}}' +
        '</div>' +
        '<div class="module_multimedia multimedia">' +
          '{{#multimedia}}' +
              '<img class="multimedia_image" alt="{{title}}" src="{{url}}" />' +
              '<span class="multimedia_info">({{width}} x {{height}}) {{type}}</span>' +
              '<div class="multimedia_sizes sizes">' +
                '{{#sizes}}' +
                    '<img class="sizes_image" alt="{{title}} {{category}}" src="{{url}}" />' +
                    '<span class="sizes_info">({{width}} x {{height}})</span>' +
                '{{/sizes}}' +
              '</div>' +
          '{{/multimedia}}' +
        '</div>' +
      '</div>' +
    '</div>'
  )
});
</script>

Options

category string
The ID of the Press releases category to fetch. Defaults to "Press Release (Default)" category. To use all categories, use: '00000000-0000-0000-0000-000000000000'. To find the ID, navigate to Content > Press Release categories in the CMS. Click the edit icon next to the category, and now look at the URL of the page. The press release category ID is the string of letters and numbers after the parameter "ItemID" in the URL.
Default value
1cb807d2-208f-4bc3-9133-6a9ad45ac3b0
loadBody boolean
Whether to fetch the body of the press releases.
Default value
false
loadShortBody boolean
Whether to fetch the shortened body of the press releases.
Default value
false
template string
  • All the notes documented in the q4.api parent widget are applicable here.
  • This widget supports template, itemTemplate and yearTemplate options.
The template or itemTemplate may contain the following mustache variables:
  • {{title}} - The title (i.e. report subtype and year) of the financial report.
  • {{url}} - The URL of the details page. Note that if URL override field is used in the CMS, this variable will changes to the URL override
  • {{seoName}} - The SEO name of the news item (ie. the unique part of the details URL)
  • {{date}} - The date of the news item.
  • {{body}} - The body content of the news item. Note this can be truncated with the widget option bodyLength. Utilizing 3 curly brackets will render the body content as HTML.
  • {{shortBody}} - The pre-defined short body content of the news item. Note this can be truncated further with the widget option shortBodyLength
  • {{thumb}} - The thumbnail image. Will be automatically generated from a related file document. If no thumbnail exists, the widget will use the URL defined by the defaultThumb option.
  • {{#docs}} - The related document. Inner variables for each document are:
  • {{docUrl}} - The URL of the document
  • {{docType}} - The file type for the document (ex. PDF). If online document category, value will be null
  • {{docSize}} - The file size. If online document category, value will be null
  • {{#attachments}} - An array of document attachment files.
    • {{type}} - The upload type of the attachment item.
    • {{extension}} - The file extension of the attachment.
    • {{size}} - The file size of the attachment.
    • {{title}} - The title of the attachment.
    • {{category}} - The attachment category.
    • {{url}} - The url link of the attachment.
  • {{#tags}} - An array of tags for this news item.
    • {{.}} - Tag word
  • {{#media}} - An array of media files found from within the news item body. For example, any images inside the press release content. Inner variables are:
    • {{url}} - The URL of the media item.
    • {{alt}} - The alt text of the media item, if available.
    • {{type}} - The file type for the media item.
    • {{height}} - The height of the media item.
    • {{width}} - The width of the media item.
  • {{#multimedia}} - An array of multimedia files populated automatically from Businesswire press releases or manually. Includes an array of different sizes (original, thumbnail, square, lowres)
    • {{active}} - Flag if multimedia is active/inactive in the CMS.
    • {{category}} - The type of multimedia (i.e. image|video|external).
    • {{fileSize}} - The file size of the item in bytes.
    • {{height}} - The height of the item in pixels.
    • {{id}} - The ID of the item.
    • {{#sizes}} - The array of sizes of the item
      • {{category}} - The type of multimedia size (i.e original|thumbnail|lowres|square).
      • {{fileSize}} - The file size of the item in bytes.
      • {{height}} - The height of the item in pixels.
      • {{url}} - The URL of the item.
      • {{width}} - The width of the item in pixels.
    • {{thumbnail}} - The URL of the thumbnail.
    • {{title}} - The title of the item.
    • {{type}} - The file type of the item.
    • {{url}} - The URL of the item.
    • {{width}} - The width of the item in pixels.