@@ -13,13 +13,13 @@ discard block |
||
| 13 | 13 | * Implements hook_help(). |
| 14 | 14 | */ |
| 15 | 15 | function media_help($route_name, RouteMatchInterface $route_match) { |
| 16 | - switch ($route_name) { |
|
| 16 | + switch ($route_name) { |
|
| 17 | 17 | // Main module help for the media module. |
| 18 | 18 | case 'help.page.media': |
| 19 | 19 | $output = ''; |
| 20 | - $output .= '<h3>' . t('About') . '</h3>'; |
|
| 21 | - $output .= '<p>' . t('Media module for Drupal 8') . '</p>'; |
|
| 22 | - return $output; |
|
| 20 | + $output .= '<h3>' . t('About') . '</h3>'; |
|
| 21 | + $output .= '<p>' . t('Media module for Drupal 8') . '</p>'; |
|
| 22 | + return $output; |
|
| 23 | 23 | |
| 24 | 24 | default: |
| 25 | 25 | } |
@@ -29,18 +29,18 @@ discard block |
||
| 29 | 29 | * Implements hook_form_alter(). |
| 30 | 30 | */ |
| 31 | 31 | function media_form_alter(&$form, FormStateInterface &$form_state) { |
| 32 | - if ($form['#form_id'] == 'entity_browser_media_library_form') { |
|
| 32 | + if ($form['#form_id'] == 'entity_browser_media_library_form') { |
|
| 33 | 33 | // Style the submit button. |
| 34 | 34 | $form['actions']['submit']['#attributes']['class'][] = 'button--primary'; |
| 35 | 35 | $form['actions']['submit']['#attributes']['class'][] = 'entity-browser-modal-target'; |
| 36 | - } |
|
| 37 | - // Remove the Gallery option from create gallery view's bundle filters. |
|
| 38 | - if ($form['#id'] == 'views-exposed-form-media-library-gallery-media-select-modal' || $form['#id'] == 'views-exposed-form-media-library-gallery-user-media-select-modal') { |
|
| 36 | + } |
|
| 37 | + // Remove the Gallery option from create gallery view's bundle filters. |
|
| 38 | + if ($form['#id'] == 'views-exposed-form-media-library-gallery-media-select-modal' || $form['#id'] == 'views-exposed-form-media-library-gallery-user-media-select-modal') { |
|
| 39 | 39 | unset($form['bundle_1']['#options']['gallery']); |
| 40 | - } |
|
| 41 | - if ($form['#form_id'] == 'media_gallery_form') { |
|
| 40 | + } |
|
| 41 | + if ($form['#form_id'] == 'media_gallery_form') { |
|
| 42 | 42 | $form['#attached']['library'][] = 'media/view'; |
| 43 | - } |
|
| 43 | + } |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
@@ -49,9 +49,9 @@ discard block |
||
| 49 | 49 | * Adds the media.view library to the media views. |
| 50 | 50 | */ |
| 51 | 51 | function media_views_pre_render(ViewExecutable $view) { |
| 52 | - if (isset($view) && ($view->storage->id() == 'media_library' || $view->storage->id() == 'global_media_library')) { |
|
| 52 | + if (isset($view) && ($view->storage->id() == 'media_library' || $view->storage->id() == 'global_media_library')) { |
|
| 53 | 53 | $view->element['#attached']['library'][] = 'media/view'; |
| 54 | - } |
|
| 54 | + } |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -60,24 +60,24 @@ discard block |
||
| 60 | 60 | * Adds the add media button from media_entity on library pages. |
| 61 | 61 | */ |
| 62 | 62 | function media_menu_local_actions_alter(&$local_actions) { |
| 63 | - $local_actions['media.add']['appears_on'][] = 'view.media_library.user_media_library'; |
|
| 64 | - $local_actions['media.add']['appears_on'][] = 'view.media_library.global_media_library_page'; |
|
| 63 | + $local_actions['media.add']['appears_on'][] = 'view.media_library.user_media_library'; |
|
| 64 | + $local_actions['media.add']['appears_on'][] = 'view.media_library.global_media_library_page'; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * Implements hook_entity_type_alter(). |
| 69 | 69 | */ |
| 70 | 70 | function media_entity_type_alter(array &$entity_types) { |
| 71 | - $field_name = \Drupal::config('media_entity.bundle.gallery')->get('type_configuration.source_field'); |
|
| 72 | - $entity_types['media']->addConstraint('GalleryMediaBundle', array('sourceFieldName' => $field_name)); |
|
| 71 | + $field_name = \Drupal::config('media_entity.bundle.gallery')->get('type_configuration.source_field'); |
|
| 72 | + $entity_types['media']->addConstraint('GalleryMediaBundle', array('sourceFieldName' => $field_name)); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
| 76 | 76 | * Implements hook_menu_links_discovered_alter(). |
| 77 | 77 | */ |
| 78 | 78 | function media_menu_links_discovered_alter(&$links) { |
| 79 | - // Media entity module provides a default view which we disable. Since it also |
|
| 80 | - // provides a link entry for it we need to update the route there to point to |
|
| 81 | - // the media library we provide. |
|
| 82 | - $links['entity.media.collection']['route_name'] = 'view.media_library.global_media_library_page'; |
|
| 79 | + // Media entity module provides a default view which we disable. Since it also |
|
| 80 | + // provides a link entry for it we need to update the route there to point to |
|
| 81 | + // the media library we provide. |
|
| 82 | + $links['entity.media.collection']['route_name'] = 'view.media_library.global_media_library_page'; |
|
| 83 | 83 | } |