@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use Symfony\Component\EventDispatcher\EventSubscriberInterface; |
6 | 6 | use Symfony\Component\EventDispatcher\Event; |
7 | -use Symfony\Component\HttpKernel\Event\KernelEvent; |
|
8 | 7 | use Symfony\Component\HttpKernel\KernelEvents; |
9 | 8 | use Symfony\Component\HttpKernel\Event\GetResponseEvent; |
10 | 9 | use Drupal\Core\Cache\CacheTagsInvalidator; |
@@ -60,7 +60,7 @@ |
||
60 | 60 | if ($node = $event->getRequest()->get('node')) { |
61 | 61 | if (\Drupal::currentUser()->hasPermission('view latest version')) { |
62 | 62 | $theme = $this->themeManager->getActiveTheme()->getName(); |
63 | - $tag = 'config:block.block.' . $theme . '_local_actions'; |
|
63 | + $tag = 'config:block.block.'.$theme.'_local_actions'; |
|
64 | 64 | $this->cacheTagsInvalidator->invalidateTags([$tag]); |
65 | 65 | } |
66 | 66 | } |
@@ -18,7 +18,7 @@ |
||
18 | 18 | * {@inheritdoc} |
19 | 19 | */ |
20 | 20 | public static function getSubscribedEvents() { |
21 | - $events[RoutingEvents::ALTER] = ['onAlterRoutes',-9999]; // negative Values means "late" |
|
21 | + $events[RoutingEvents::ALTER] = ['onAlterRoutes', -9999]; // negative Values means "late" |
|
22 | 22 | return $events; |
23 | 23 | } |
24 | 24 |
@@ -10,13 +10,13 @@ |
||
10 | 10 | foreach ($geofield_map as $entity_type_id => $fields) { |
11 | 11 | foreach ($fields as $field_name => $info) { |
12 | 12 | $args = array('@field_name' => $field_name); |
13 | - $data_key = $entity_type_id . '__' . $field_name; |
|
13 | + $data_key = $entity_type_id.'__'.$field_name; |
|
14 | 14 | |
15 | 15 | $field_coordinates_table_data = $data[$data_key][$field_name]; |
16 | - $data[$data_key][$data_key . '_simple_proximity'] = [ |
|
16 | + $data[$data_key][$data_key.'_simple_proximity'] = [ |
|
17 | 17 | 'group' => 'Content', |
18 | 18 | 'title' => t('Simple Proximity (@field_name)', $args), |
19 | - 'title short' => $field_coordinates_table_data['title short'] . t(' Simple Proximity'), |
|
19 | + 'title short' => $field_coordinates_table_data['title short'].t(' Simple Proximity'), |
|
20 | 20 | 'help' => $field_coordinates_table_data['help'], |
21 | 21 | 'real field' => $field_name, |
22 | 22 | 'filter' => [ |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | // Don't show this element in the context of an admin menu. |
57 | 57 | if (!isset($form['admin_label'])) { |
58 | 58 | $form['value']['#suffix'] = |
59 | - '<a class="simple-proximity-location-button button" title="' . $this->t('Use your current location') . '">' . |
|
60 | - ' <i class="fa fa-map-marker" aria-hidden="true"></i>' . |
|
61 | - '</a>' . $form['value']['#suffix']; |
|
59 | + '<a class="simple-proximity-location-button button" title="'.$this->t('Use your current location').'">'. |
|
60 | + ' <i class="fa fa-map-marker" aria-hidden="true"></i>'. |
|
61 | + '</a>'.$form['value']['#suffix']; |
|
62 | 62 | $form['value']['#attached'] = ['library' => ['df_tools_map/main']]; |
63 | 63 | } |
64 | 64 | } |
@@ -109,15 +109,15 @@ discard block |
||
109 | 109 | |
110 | 110 | // Geocode the location if it's present. |
111 | 111 | if (!empty($location)) { |
112 | - if ($collection = \Drupal::service('geocoder')->geocode($location,['googlemaps'])) { |
|
112 | + if ($collection = \Drupal::service('geocoder')->geocode($location, ['googlemaps'])) { |
|
113 | 113 | $coordinates = $collection->first()->getCoordinates(); |
114 | 114 | |
115 | 115 | // Generate a distance formula programatically. |
116 | 116 | $haversine_options = [ |
117 | 117 | 'origin_latitude' => $coordinates->getLatitude(), |
118 | 118 | 'origin_longitude' => $coordinates->getLongitude(), |
119 | - 'destination_latitude' => $this->table . '.' . $this->realField . '_lat', |
|
120 | - 'destination_longitude' => $this->table . '.' . $this->realField . '_lon', |
|
119 | + 'destination_latitude' => $this->table.'.'.$this->realField.'_lat', |
|
120 | + 'destination_longitude' => $this->table.'.'.$this->realField.'_lon', |
|
121 | 121 | 'earth_radius' => GEOFIELD_KILOMETERS, |
122 | 122 | ]; |
123 | 123 | |
@@ -125,13 +125,13 @@ discard block |
||
125 | 125 | |
126 | 126 | /** @var \Drupal\views\Plugin\views\query\Sql $query */ |
127 | 127 | $query = $this->query; |
128 | - $query->addOrderBy(NULL, $formula, 'ASC', $this->table . '_simple_proximity'); |
|
128 | + $query->addOrderBy(NULL, $formula, 'ASC', $this->table.'_simple_proximity'); |
|
129 | 129 | |
130 | 130 | // Add a where expression if a distance is used. |
131 | 131 | if ($this->options['expose']['distance']) { |
132 | 132 | $distance = $this->options['expose']['distance']; |
133 | - $placeholder = $query->placeholder($this->table . '_simple_proximity'); |
|
134 | - $query->addWhereExpression(0, '(' . $formula . ' <= ' . $placeholder . ')', [$placeholder => $distance]); |
|
133 | + $placeholder = $query->placeholder($this->table.'_simple_proximity'); |
|
134 | + $query->addWhereExpression(0, '('.$formula.' <= '.$placeholder.')', [$placeholder => $distance]); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | } |
@@ -149,10 +149,10 @@ discard block |
||
149 | 149 | |
150 | 150 | foreach ($options as $key => $option) { |
151 | 151 | if (is_numeric($option)) { |
152 | - $formula = str_replace(':' . $key, $option, $formula); |
|
152 | + $formula = str_replace(':'.$key, $option, $formula); |
|
153 | 153 | } |
154 | 154 | else { |
155 | - $formula = str_replace(':' . $key, db_escape_field($option), $formula); |
|
155 | + $formula = str_replace(':'.$key, db_escape_field($option), $formula); |
|
156 | 156 | } |
157 | 157 | } |
158 | 158 |
@@ -102,8 +102,7 @@ discard block |
||
102 | 102 | $this->ensureMyTable(); |
103 | 103 | if (is_array($this->value)) { |
104 | 104 | $location = $this->value[0]; |
105 | - } |
|
106 | - else { |
|
105 | + } else { |
|
107 | 106 | $location = $this->value; |
108 | 107 | } |
109 | 108 | |
@@ -150,8 +149,7 @@ discard block |
||
150 | 149 | foreach ($options as $key => $option) { |
151 | 150 | if (is_numeric($option)) { |
152 | 151 | $formula = str_replace(':' . $key, $option, $formula); |
153 | - } |
|
154 | - else { |
|
152 | + } else { |
|
155 | 153 | $formula = str_replace(':' . $key, db_escape_field($option), $formula); |
156 | 154 | } |
157 | 155 | } |
@@ -142,7 +142,7 @@ |
||
142 | 142 | * |
143 | 143 | * @param $options |
144 | 144 | * |
145 | - * @return mixed|string |
|
145 | + * @return string |
|
146 | 146 | */ |
147 | 147 | protected function haversine($options) { |
148 | 148 | $formula = '( :earth_radius * ACOS( COS( RADIANS(:origin_latitude) ) * COS( RADIANS(:destination_latitude) ) * COS( RADIANS(:destination_longitude) - RADIANS(:origin_longitude) ) + SIN( RADIANS(:origin_latitude) ) * SIN( RADIANS(:destination_latitude) ) ) )'; |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | public function prepareRow(Row $row) { |
18 | 18 | // Prefix the state per the normal Address schema. |
19 | 19 | if ($state = $row->getSourceProperty('Address State')) { |
20 | - $row->setSourceProperty('Address State', 'US-' . $state); |
|
20 | + $row->setSourceProperty('Address State', 'US-'.$state); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | // Use a cached geolocation if possible. |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $zip = $row->getSourceProperty('Address Zip'); |
35 | 35 | |
36 | 36 | if ($address && $city && $zip && $state) { |
37 | - $address2 = $address2 ? $address2 . "\n" : ''; |
|
37 | + $address2 = $address2 ? $address2."\n" : ''; |
|
38 | 38 | $address_string = "$address\n$address2$city, $state $zip\nUS"; |
39 | 39 | if ($collection = \Drupal::service('geocoder')->geocode($address_string, ['googlemaps'])) { |
40 | 40 | // Set our value in a similar way to Geofield's LatLon Widget. |
@@ -25,8 +25,7 @@ |
||
25 | 25 | list($lat, $lon) = explode(',', $geolocation); |
26 | 26 | $point = [$lon, $lat]; |
27 | 27 | $row->setSourceProperty('Geofield', \Drupal::service('geofield.wkt_generator')->WktBuildPoint($point)); |
28 | - } |
|
29 | - else { |
|
28 | + } else { |
|
30 | 29 | // Manually geocode from source information. |
31 | 30 | $address = $row->getSourceProperty('Address Line 1'); |
32 | 31 | $address2 = $row->getSourceProperty('Address Line 2'); |
@@ -6,6 +6,6 @@ |
||
6 | 6 | function df_tools_frontend_library_info_alter(&$libraries, $extension) { |
7 | 7 | if ($extension == 'image') { |
8 | 8 | $path = drupal_get_path('module', 'df_tools_frontend'); |
9 | - $libraries['quickedit.inPlaceEditor.image']['js']['/' . $path . '/js/quickedit_image_browser.js'] = []; |
|
9 | + $libraries['quickedit.inPlaceEditor.image']['js']['/'.$path.'/js/quickedit_image_browser.js'] = []; |
|
10 | 10 | } |
11 | 11 | } |
@@ -90,8 +90,7 @@ discard block |
||
90 | 90 | $entity_view_mode_ids = array_keys($this->entityManager()->getViewModes($entity->getEntityTypeId())); |
91 | 91 | if (in_array($view_mode_id, $entity_view_mode_ids)) { |
92 | 92 | $output = $entity->$field_name->view($view_mode_id); |
93 | - } |
|
94 | - else { |
|
93 | + } else { |
|
95 | 94 | // Each part of a custom (non-Entity Display) view mode ID is separated |
96 | 95 | // by a dash; the first part must be the module name. |
97 | 96 | $mode_id_parts = explode('-', $view_mode_id, 2); |
@@ -108,8 +107,7 @@ discard block |
||
108 | 107 | 'html' => $this->renderer->renderRoot($output), |
109 | 108 | ]; |
110 | 109 | return new JsonResponse($data); |
111 | - } |
|
112 | - else { |
|
110 | + } else { |
|
113 | 111 | return new JsonResponse(['main_error' => $this->t('File does not exist.')]); |
114 | 112 | } |
115 | 113 | } |
@@ -48,7 +48,7 @@ |
||
48 | 48 | if ($migration != null) { |
49 | 49 | $definition = $migration->getPluginDefinition(); |
50 | 50 | $dump = Yaml::dump($definition); |
51 | - $file_url = $destination . $migration->id() . '.yml'; |
|
51 | + $file_url = $destination.$migration->id().'.yml'; |
|
52 | 52 | $message = t('Export migration @name?', ['@name' => $name]); |
53 | 53 | if (drush_confirm($message) && $data = file_save_data($dump, $file_url)) { |
54 | 54 | drush_print(t('File saved: @file', ['@file' => $data->getFileUri()])); |
@@ -75,8 +75,7 @@ |
||
75 | 75 | $dir = rtrim($dir, '/'); |
76 | 76 | if ($dir == 'public') { |
77 | 77 | $file_pattern = "[^\/]*"; // Finds anything that does not contain "/", should be fine. |
78 | - } |
|
79 | - else { |
|
78 | + } else { |
|
80 | 79 | $file_pattern = $dir ? $dir . ".+" : ".+"; |
81 | 80 | } |
82 | 81 |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | $file_pattern = "[^\/]*"; // Finds anything that does not contain "/", should be fine. |
56 | 56 | } |
57 | 57 | else { |
58 | - $file_pattern = $dir ? $dir . ".+" : ".+"; |
|
58 | + $file_pattern = $dir ? $dir.".+" : ".+"; |
|
59 | 59 | } |
60 | 60 | |
61 | - $regex = "^public:\/\/(" . $file_pattern . ")\.(" . implode($extensions, '|') . ")$"; |
|
61 | + $regex = "^public:\/\/(".$file_pattern.")\.(".implode($extensions, '|').")$"; |
|
62 | 62 | |
63 | 63 | // Query the database for files that match this pattern. |
64 | 64 | $query = db_select('file_managed', 'f') |
65 | - ->condition('filemime', $mimetypes , 'IN') |
|
65 | + ->condition('filemime', $mimetypes, 'IN') |
|
66 | 66 | ->condition('uri', $regex, 'REGEXP'); |
67 | 67 | $total_count = $query->countQuery()->execute()->fetchField(); |
68 | 68 | |
@@ -81,12 +81,12 @@ discard block |
||
81 | 81 | |
82 | 82 | foreach (\Drupal\image\Entity\ImageStyle::loadMultiple() as $name => $style) { |
83 | 83 | if (!empty($excludes) && in_array($style->getName(), $excludes)) { |
84 | - $operations[] = array('drush_log', array('Excluding ' . $name, 'success')); |
|
84 | + $operations[] = array('drush_log', array('Excluding '.$name, 'success')); |
|
85 | 85 | continue; |
86 | 86 | } |
87 | 87 | |
88 | 88 | if (empty($includes[0]) || in_array($style->getName(), $includes)) { |
89 | - $operations[] = array('drush_log', array('Processing ' . $name, 'success')); |
|
89 | + $operations[] = array('drush_log', array('Processing '.$name, 'success')); |
|
90 | 90 | $count = 1; |
91 | 91 | $last_progress = 0; |
92 | 92 | foreach ($files as $file) { |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | if (($progress % 25 === 0 || $progress % 7 === 0) && $progress != $last_progress) { |
100 | 100 | // If we're in the command line, print the percentage, otherwise hide it |
101 | 101 | if (PHP_SAPI === 'cli') { |
102 | - $operations[] = array('drush_print', array('...' . $progress . '%', 0, NULL, ($progress == 100))); |
|
102 | + $operations[] = array('drush_print', array('...'.$progress.'%', 0, NULL, ($progress == 100))); |
|
103 | 103 | } |
104 | 104 | $last_progress = $progress; |
105 | 105 | } |