forked from grasmash/drupal-views-itunes-rss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathitunes_rss.module
46 lines (42 loc) · 1.16 KB
/
itunes_rss.module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/**
* @file
* Provides iTunes RSS feed via views.
*/
/**
* Implements hook_theme().
*/
function itunes_rss_theme() {
$theme_registry['views_view_itunes_rss'] = [
'variables' => [
'view' => NULL,
'options' => NULL,
'rows' => NULL,
'title' => NULL,
],
'path' => 'templates',
'includes' => ['core/modules/views/views.theme.inc'],
'template' => 'views-view-itunes-rss',
];
return $theme_registry;
}
/**
* Prepares variables for RSS feed templates.
*
* Default template: views-view-rss.html.twig.
*
* @param array $variables
* An associative array containing:
* - view: A ViewExecutable object.
* - rows: The raw row data.
*/
function template_preprocess_views_view_itunes_rss(array &$variables) {
template_preprocess_views_view_rss($variables);
$view = $variables['view'];
$style = $view->style_plugin;
$variables['image_url'] = $style->getImage();
$variables['itunes_category'] = $style->options['category'];
$variables['itunes_explicit'] = $style->options['explicit'] ? 'yes' : 'no';
$variables['itunes_name'] = $style->options['name'];
$variables['itunes_email'] = $style->options['email'];
}