@@ -12,13 +12,13 @@ discard block |
||
| 12 | 12 | * Implements hook_help(). |
| 13 | 13 | */ |
| 14 | 14 | function media_help($route_name, RouteMatchInterface $route_match) { |
| 15 | - switch ($route_name) { |
|
| 15 | + switch ($route_name) { |
|
| 16 | 16 | // Main module help for the media module. |
| 17 | 17 | case 'help.page.media': |
| 18 | 18 | $output = ''; |
| 19 | - $output .= '<h3>' . t('About') . '</h3>'; |
|
| 20 | - $output .= '<p>' . t('Media module for Drupal 8') . '</p>'; |
|
| 21 | - return $output; |
|
| 19 | + $output .= '<h3>' . t('About') . '</h3>'; |
|
| 20 | + $output .= '<p>' . t('Media module for Drupal 8') . '</p>'; |
|
| 21 | + return $output; |
|
| 22 | 22 | |
| 23 | 23 | default: |
| 24 | 24 | } |
@@ -28,28 +28,28 @@ discard block |
||
| 28 | 28 | * Implements hook_form_alter(). |
| 29 | 29 | */ |
| 30 | 30 | function media_form_alter(&$form, FormStateInterface &$form_state) { |
| 31 | - if (isset($form['#form_id'])) { |
|
| 31 | + if (isset($form['#form_id'])) { |
|
| 32 | 32 | if ($form['#form_id'] == 'entity_browser_media_library_form') { |
| 33 | - // Attach our library. |
|
| 34 | - $form['#attached']['library'][] = 'media/view'; |
|
| 33 | + // Attach our library. |
|
| 34 | + $form['#attached']['library'][] = 'media/view'; |
|
| 35 | 35 | |
| 36 | - // Style the submit button. |
|
| 37 | - $form['actions']['submit']['#value'] = t('Select Media Files'); |
|
| 38 | - $form['actions']['submit']['#attributes']['class'][] = 'button--primary'; |
|
| 39 | - $form['actions']['submit']['#attributes']['class'][] = 'entity-browser-modal-target'; |
|
| 36 | + // Style the submit button. |
|
| 37 | + $form['actions']['submit']['#value'] = t('Select Media Files'); |
|
| 38 | + $form['actions']['submit']['#attributes']['class'][] = 'button--primary'; |
|
| 39 | + $form['actions']['submit']['#attributes']['class'][] = 'entity-browser-modal-target'; |
|
| 40 | 40 | |
| 41 | - // Wrap actions so we can float them at the bottom of the browser. |
|
| 42 | - $form['actions_wrap'] = [ |
|
| 41 | + // Wrap actions so we can float them at the bottom of the browser. |
|
| 42 | + $form['actions_wrap'] = [ |
|
| 43 | 43 | '#type' => 'container', |
| 44 | 44 | '#attributes' => [ |
| 45 | - 'class' => 'file-browser-actions', |
|
| 45 | + 'class' => 'file-browser-actions', |
|
| 46 | 46 | ], |
| 47 | 47 | 0 => $form['actions'], |
| 48 | - ]; |
|
| 49 | - unset($form['actions']); |
|
| 48 | + ]; |
|
| 49 | + unset($form['actions']); |
|
| 50 | 50 | |
| 51 | - // Add a class for generic styling. |
|
| 52 | - $form['#attributes']['class'][] = 'file-browser-form'; |
|
| 51 | + // Add a class for generic styling. |
|
| 52 | + $form['#attributes']['class'][] = 'file-browser-form'; |
|
| 53 | + } |
|
| 53 | 54 | } |
| 54 | - } |
|
| 55 | 55 | } |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | /** |
| 28 | 28 | * Implements hook_form_alter(). |
| 29 | 29 | */ |
| 30 | -function media_form_alter(&$form, FormStateInterface &$form_state) { |
|
| 30 | +function media_form_alter(&$form, FormStateInterface & $form_state) { |
|
| 31 | 31 | if (isset($form['#form_id'])) { |
| 32 | 32 | if ($form['#form_id'] == 'entity_browser_media_library_form') { |
| 33 | 33 | // Attach our library. |
@@ -25,10 +25,10 @@ discard block |
||
| 25 | 25 | * @var array |
| 26 | 26 | */ |
| 27 | 27 | public static $modules = [ |
| 28 | - 'media', |
|
| 29 | - 'media_entity', |
|
| 30 | - 'media_entity_slideshow', |
|
| 31 | - 'node', |
|
| 28 | + 'media', |
|
| 29 | + 'media_entity', |
|
| 30 | + 'media_entity_slideshow', |
|
| 31 | + 'node', |
|
| 32 | 32 | ]; |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -46,13 +46,13 @@ discard block |
||
| 46 | 46 | $this->testBundle = $this->container->get('entity_type.manager')->getStorage('media_bundle')->load('gallery'); |
| 47 | 47 | |
| 48 | 48 | $adminUser = $this->drupalCreateUser([ |
| 49 | - 'view media', |
|
| 50 | - 'create media', |
|
| 51 | - 'update media', |
|
| 52 | - 'update any media', |
|
| 53 | - 'delete media', |
|
| 54 | - 'delete any media', |
|
| 55 | - 'access media overview', |
|
| 49 | + 'view media', |
|
| 50 | + 'create media', |
|
| 51 | + 'update media', |
|
| 52 | + 'update any media', |
|
| 53 | + 'delete media', |
|
| 54 | + 'delete any media', |
|
| 55 | + 'access media overview', |
|
| 56 | 56 | ]); |
| 57 | 57 | $this->drupalLogin($adminUser); |
| 58 | 58 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function testMediaBundleCreationFromModule() { |
| 64 | 64 | $type_configuration = [ |
| 65 | - 'source_field' => 'field_slide', |
|
| 65 | + 'source_field' => 'field_slide', |
|
| 66 | 66 | ]; |
| 67 | 67 | |
| 68 | 68 | $this->assertTrue((bool) $this->testBundle, 'The media bundle from default configuration has been created in the database.'); |
@@ -83,9 +83,9 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | $this->drupalGet('media/add/gallery'); |
| 85 | 85 | $edit = [ |
| 86 | - 'name[0][value]' => 'Gallery item', |
|
| 87 | - 'field_slide[0][target_id]' => $imageItem['name[0][value]'] . ' (' . $imageItem['id'] . ')', |
|
| 88 | - 'field_slide[0][_weight]' => 0, |
|
| 86 | + 'name[0][value]' => 'Gallery item', |
|
| 87 | + 'field_slide[0][target_id]' => $imageItem['name[0][value]'] . ' (' . $imageItem['id'] . ')', |
|
| 88 | + 'field_slide[0][_weight]' => 0, |
|
| 89 | 89 | ]; |
| 90 | 90 | $this->drupalPostAjaxForm(NULL, $edit, 'field_slide_add_more'); |
| 91 | 91 | $edit['field_slide[1][target_id]'] = $videoItem['name[0][value]'] . ' (' . $videoItem['id'] . ')'; |
@@ -105,9 +105,9 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | $this->drupalGet('media/add/gallery'); |
| 107 | 107 | $edit = [ |
| 108 | - 'name[0][value]' => 'Gallery item 2', |
|
| 109 | - 'field_slide[0][target_id]' => $videoItem['name[0][value]'] . ' (' . $videoItem['id'] . ')', |
|
| 110 | - 'field_slide[0][_weight]' => 0, |
|
| 108 | + 'name[0][value]' => 'Gallery item 2', |
|
| 109 | + 'field_slide[0][target_id]' => $videoItem['name[0][value]'] . ' (' . $videoItem['id'] . ')', |
|
| 110 | + 'field_slide[0][_weight]' => 0, |
|
| 111 | 111 | ]; |
| 112 | 112 | $this->drupalPostAjaxForm(NULL, $edit, 'field_slide_add_more'); |
| 113 | 113 | $edit['field_slide[1][target_id]'] = $imageItem['name[0][value]'] . ' (' . $imageItem['id'] . ')'; |
@@ -130,8 +130,8 @@ discard block |
||
| 130 | 130 | $testImage = current($this->drupalGetTestFiles('image')); |
| 131 | 131 | $file_path = $this->container->get('file_system')->realpath($testImage->uri); |
| 132 | 132 | $edit = [ |
| 133 | - 'name[0][value]' => $name, |
|
| 134 | - 'files[field_image_0]' => $file_path, |
|
| 133 | + 'name[0][value]' => $name, |
|
| 134 | + 'files[field_image_0]' => $file_path, |
|
| 135 | 135 | ]; |
| 136 | 136 | // Save the image. |
| 137 | 137 | $this->drupalPostForm('media/add/image', $edit, t('Save and publish')); |
@@ -149,8 +149,8 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | public function addVideoItem() { |
| 151 | 151 | $edit = [ |
| 152 | - 'name[0][value]' => 'Drupal video!', |
|
| 153 | - 'field_video[0][value]' => 'https://www.youtube.com/watch?v=XgYu7-DQjDQ', |
|
| 152 | + 'name[0][value]' => 'Drupal video!', |
|
| 153 | + 'field_video[0][value]' => 'https://www.youtube.com/watch?v=XgYu7-DQjDQ', |
|
| 154 | 154 | ]; |
| 155 | 155 | $this->drupalPostForm('media/add/video', $edit, t('Save and publish')); |
| 156 | 156 | // Obtain the video id. |
@@ -172,8 +172,8 @@ discard block |
||
| 172 | 172 | */ |
| 173 | 173 | public function loadMediaItem($id) { |
| 174 | 174 | $item = $this->container->get('entity_type.manager') |
| 175 | - ->getStorage('media') |
|
| 176 | - ->loadUnchanged($id); |
|
| 175 | + ->getStorage('media') |
|
| 176 | + ->loadUnchanged($id); |
|
| 177 | 177 | return $item; |
| 178 | 178 | } |
| 179 | 179 | |