Completed
Push — 8.x-1.x ( e3b4ed...18ef99 )
by Janez
03:17
created
entity_browser.module 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
 /**
43 43
  * Implements hook_form_alter().
44 44
  */
45
-function entity_browser_form_alter(&$form, FormStateInterface &$form_state) {
45
+function entity_browser_form_alter(&$form, FormStateInterface&$form_state) {
46 46
   $entity_browser_dialog_edit = \Drupal::service('request_stack')->getCurrentRequest()->get('_route');
47 47
   if ($entity_browser_dialog_edit == 'entity_browser.edit_form') {
48 48
     // Let's allow the save button only.
Please login to merge, or discard this patch.
modules/entity_form/src/Plugin/EntityBrowser/Widget/EntityForm.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     $definitions = $this->entityManager->getDefinitions();
66 66
     $entity_types = array_combine(
67 67
       array_keys($definitions),
68
-      array_map(function (EntityTypeInterface $item) { return $item->getLabel(); }, $definitions)
68
+      array_map(function(EntityTypeInterface $item) { return $item->getLabel(); }, $definitions)
69 69
     );
70 70
 
71 71
     $form['entity_type'] = [
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     $bundles = [];
83 83
     if ($entity_type) {
84 84
       $definitions = $this->entityManager->getBundleInfo($entity_type);
85
-      $bundles = array_map(function ($item) { return $item['label']; }, $definitions);
85
+      $bundles = array_map(function($item) { return $item['label']; }, $definitions);
86 86
     }
87 87
 
88 88
     $form['bundle'] = [
Please login to merge, or discard this patch.
src/Plugin/EntityBrowser/Display/IFrame.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
             'entity_browser' => [
170 170
               'iframe' => [
171 171
                 $uuid => [
172
-                  'src' => Url::fromRoute('entity_browser.' . $this->configuration['entity_browser_id'], [], $data['query_parameters'])
172
+                  'src' => Url::fromRoute('entity_browser.'.$this->configuration['entity_browser_id'], [], $data['query_parameters'])
173 173
                     ->toString(),
174 174
                   'width' => $this->configuration['width'],
175 175
                   'height' => $this->configuration['height'],
@@ -203,13 +203,13 @@  discard block
 block discarded – undo
203 203
   public function propagateSelection(FilterResponseEvent $event) {
204 204
     $render = [
205 205
       'labels' => [
206
-        '#markup' => 'Labels: ' . implode(', ', array_map(function (EntityInterface $item) {return $item->label();}, $this->entities)),
206
+        '#markup' => 'Labels: '.implode(', ', array_map(function(EntityInterface $item) {return $item->label(); }, $this->entities)),
207 207
         '#attached' => [
208 208
           'library' => ['entity_browser/iframe_selection'],
209 209
           'drupalSettings' => [
210 210
             'entity_browser' => [
211 211
               'iframe' => [
212
-                'entities' => array_map(function (EntityInterface $item) {return [$item->id(), $item->uuid(), $item->getEntityTypeId()];}, $this->entities),
212
+                'entities' => array_map(function(EntityInterface $item) {return [$item->id(), $item->uuid(), $item->getEntityTypeId()]; }, $this->entities),
213 213
                 'uuid' => $this->request->query->get('uuid'),
214 214
               ],
215 215
             ],
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
    * {@inheritdoc}
243 243
    */
244 244
   public function path() {
245
-    return '/entity-browser/iframe/' . $this->configuration['entity_browser_id'];
245
+    return '/entity-browser/iframe/'.$this->configuration['entity_browser_id'];
246 246
   }
247 247
 
248 248
   /**
Please login to merge, or discard this patch.
modules/entity_form/entity_browser_entity_form.module 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 /**
8 8
  * Implements hook_inline_entity_form_reference_form_alter().
9 9
  */
10
-function entity_browser_entity_form_inline_entity_form_reference_form_alter(&$reference_form, \Drupal\Core\Form\FormStateInterface &$form_state) {
10
+function entity_browser_entity_form_inline_entity_form_reference_form_alter(&$reference_form, \Drupal\Core\Form\FormStateInterface&$form_state) {
11 11
   $entity_manager = \Drupal::entityManager();
12 12
   \Drupal::service('event_dispatcher')
13 13
     ->addListener(
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
   $instance = $form_state->get(['inline_entity_form', $reference_form['#ief_id'], 'instance']);
20 20
 
21 21
   /** @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface $form_display */
22
-  $entity_form_id = $instance->getTargetEntityTypeId() . '.' . $instance->getTargetBundle() . '.default';
22
+  $entity_form_id = $instance->getTargetEntityTypeId().'.'.$instance->getTargetBundle().'.default';
23 23
   // TODO - 'default' might become configurable or something else in the future.
24 24
   // See https://www.drupal.org/node/2510274
25 25
   $form_display = $entity_manager->getStorage('entity_form_display')->load($entity_form_id);
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
   $form_values = NestedArray::getValue($form_state->getValues(), $reference_form['#parents']);
117 117
   $storage = \Drupal::entityTypeManager()->getStorage($reference_form['#entity_type']);
118 118
   $attach_entities = $storage->loadMultiple(explode(' ', $form_values['entity_id']));
119
-  $entities =& $form_state->get(['inline_entity_form', $ief_id, 'entities']);
119
+  $entities = & $form_state->get(['inline_entity_form', $ief_id, 'entities']);
120 120
 
121 121
   // Determine the correct weight of the new element.
122 122
   $weight = 0;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -116,8 +116,7 @@
 block discarded – undo
116 116
 
117 117
     if (!$this->isSelectionCompleted($form_state)) {
118 118
       $form_state->setRebuild();
119
-    }
120
-    else {
119
+    } else {
121 120
       $entity_browser->getDisplay()->selectionCompleted($this->getSelectedEntities($form_state));
122 121
     }
123 122
   }
Please login to merge, or discard this patch.
src/Wizard/EntityBrowserWizard.php 1 patch
Doc Comments   +1 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,9 +34,7 @@
 block discarded – undo
34 34
    *   The entity manager.
35 35
    * @param $tempstore_id
36 36
    *   The shared temp store factory collection name.
37
-   * @param null $machine_name
38
-   *   The SharedTempStore key for our current wizard values.
39
-   * @param null $step
37
+   * @param string|null $step
40 38
    *   The current active step of the wizard.
41 39
    */
42 40
   public function __construct(SharedTempStoreFactory $tempstore, FormBuilderInterface $builder, ClassResolverInterface $class_resolver, EventDispatcherInterface $event_dispatcher, EntityManagerInterface $entity_manager, RouteMatchInterface $route_match, $tempstore_id, $entity_browser = NULL, $step = 'general') {
Please login to merge, or discard this patch.
src/Tests/EntityBrowserUITest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@
 block discarded – undo
67 67
     $file = File::load(1);
68 68
     // Test entity browser token that has upload location configured to
69 69
     // public://[current-user:account-name]/
70
-    $this->assertEqual($file->getFileUri(), 'public://' . $account->getUsername() . '/' . $file->getFilename(), 'Image has the correct uri.');
70
+    $this->assertEqual($file->getFileUri(), 'public://'.$account->getUsername().'/'.$file->getFilename(), 'Image has the correct uri.');
71 71
   }
72 72
 
73 73
 }
Please login to merge, or discard this patch.
src/Plugin/EntityBrowser/SelectionDisplay/View.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     // them only once. Reason for that is how SQL and Views work and we probably
53 53
     // can't do much about it.
54 54
     if (!empty($this->selectedEntities)) {
55
-      $ids = array_map(function(EntityInterface $item) {return $item->id();}, $this->selectedEntities);
55
+      $ids = array_map(function(EntityInterface $item) {return $item->id(); }, $this->selectedEntities);
56 56
       $storage['selection_display_view']->setArguments([implode(',', $ids)]);
57 57
     }
58 58
 
@@ -85,15 +85,15 @@  discard block
 block discarded – undo
85 85
     // Get all views displays.
86 86
     $views = Views::getAllViews();
87 87
     foreach ($views as $view_id => $view) {
88
-      foreach ($view->get('display') as $display_id => $display)  {
89
-        $options[$view_id . '.' . $display_id] = $this->t('@view : @display', array('@view' => $view->label(), '@display' => $display['display_title']));
88
+      foreach ($view->get('display') as $display_id => $display) {
89
+        $options[$view_id.'.'.$display_id] = $this->t('@view : @display', array('@view' => $view->label(), '@display' => $display['display_title']));
90 90
       }
91 91
     }
92 92
 
93 93
     $form['view'] = [
94 94
       '#type' => 'select',
95 95
       '#title' => $this->t('View : View display'),
96
-      '#default_value' => $this->configuration['view'] . '.' . $this->configuration['view_display'],
96
+      '#default_value' => $this->configuration['view'].'.'.$this->configuration['view_display'],
97 97
       '#options' => $options,
98 98
       '#required' => TRUE,
99 99
       '#description' => 'View display to use for displaying currently selected items. Do note that to get something usefull out of this display, its first contextual filter should be a filter on the primary identifier field of your entity type (e.g., Node ID, Media ID).',
Please login to merge, or discard this patch.