Completed
Pull Request — 8.x-1.x (#33)
by
unknown
02:29
created

url_embed.module::url_embed_theme()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 4
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
use Drupal\editor\Entity\Editor;
4
5
/**
6
 * Implements hook_theme().
7
 */
8
function url_embed_theme($existing, $type, $theme, $path) {
0 ignored issues
show
Unused Code introduced by
The parameter $existing is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $type is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $theme is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $path is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
9
  return [
10
    'responsive_embed' => [
11
      'variables' => [
12
        'url_output' => NULL,
13
        'ratio' => NULL
14
      ]
15
    ],
16
  ];
17
}
18
19
/**
20
 * Implements hook_ckeditor_css_alter().
21
 */
22
function url_embed_ckeditor_css_alter(array &$css, Editor $editor) {
23
  $filter = $editor->getFilterFormat()->filters('url_embed');
24
  $config = $filter->getConfiguration();
25
26
  // Add the responsive embed css if the url_embed module has it enabled
27
  if (!empty($config['settings']['enable_responsive'])) {
28
    $css[] = drupal_get_path('module', 'url_embed') . '/css/url_embed.responsive.css';
29
  }
30
}
31