Commit c4ab5c10 authored by Lily Yan's avatar Lily Yan
Browse files

ISTWCMS-3825 Add Feed: Web-resources news

parent f771be63
langcode: en
status: true
dependencies:
module:
- aggregator
id: aggregator_feed.aggregator_feed.default
targetEntityType: aggregator_feed
bundle: aggregator_feed
mode: default
content:
checked:
type: timestamp_ago
weight: 1
region: content
settings: { }
third_party_settings: { }
label: inline
description:
weight: 3
region: content
feed_icon:
weight: 5
region: content
image:
weight: 2
region: content
items:
weight: 0
region: content
link:
type: uri_link
weight: 4
region: content
settings: { }
third_party_settings: { }
label: inline
hidden:
langcode: true
more_link: true
langcode: en
status: true
dependencies:
config:
- core.entity_view_mode.aggregator_feed.summary
module:
- aggregator
id: aggregator_feed.aggregator_feed.summary
targetEntityType: aggregator_feed
bundle: aggregator_feed
mode: summary
content:
items:
weight: 0
region: content
more_link:
weight: 1
region: content
hidden:
checked: true
description: true
feed_icon: true
image: true
langcode: true
link: true
langcode: en
status: true
dependencies:
config:
- core.entity_view_mode.aggregator_item.summary
module:
- aggregator
id: aggregator_item.aggregator_item.summary
targetEntityType: aggregator_item
bundle: aggregator_item
mode: summary
content:
timestamp:
weight: 0
region: content
hidden:
author: true
description: true
feed: true
langcode: true
link: true
<?php
/**
* @file
* Install, update and uninstall for UW Sites all.
*/
use Drupal\node\Entity\Node;
use Drupal\pathauto\PathautoState;
/**
* Implements hook_install().
*/
function uw_sites_all_install() {
// Add web resources news feed.
$title = 'Web-resources news';
$fid = db_query('SELECT fid FROM {aggregator_feed} WHERE title = :title', array(':title' => $title))->fetchCol();
if (empty($fid)) {
$feed = \Drupal::entityTypeManager()->getStorage('aggregator_feed')->create(array(
'uuid' => \Drupal::service('uuid')->generate(),
'title' => $title,
'url' => 'https://uwaterloo.ca/web-resources/news/news.xml',
'created' => time(),
));
$feed->save();
}
}
/**
* Implements hook_uninstall().
*/
function uw_sites_all_uninstall() {
$title = "Web-resources news";
$fid = db_query('SELECT fid FROM {aggregator_feed} WHERE title = :title', array(':title' => $title))->fetchCol();
if (!empty($fid)) {
db_delete('aggregator_feed')
->condition('fid', $fid)
->execute();
db_delete('aggregator_item')
->condition('fid', $fid)
->execute();
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment