@@ -8,7 +8,6 @@ |
||
8 | 8 | namespace Drupal\crop\Entity; |
9 | 9 | |
10 | 10 | use Drupal\Core\Config\Entity\ConfigEntityBundleBase; |
11 | -use Drupal\Core\Entity\EntityConstraintViolationList; |
|
12 | 11 | use Drupal\crop\CropTypeInterface; |
13 | 12 | use Symfony\Component\Validator\ConstraintViolationList; |
14 | 13 |
@@ -107,7 +107,7 @@ |
||
107 | 107 | */ |
108 | 108 | public static function getCropTypeNames() { |
109 | 109 | return array_map( |
110 | - function ($bundle_info) { return $bundle_info['label'];}, |
|
110 | + function($bundle_info) { return $bundle_info['label']; }, |
|
111 | 111 | \Drupal::entityManager()->getBundleInfo('crop') |
112 | 112 | ); |
113 | 113 | } |
@@ -128,8 +128,7 @@ |
||
128 | 128 | |
129 | 129 | if ($status == SAVED_UPDATED) { |
130 | 130 | drupal_set_message(t('The crop type %name has been updated.', $t_args)); |
131 | - } |
|
132 | - elseif ($status == SAVED_NEW) { |
|
131 | + } elseif ($status == SAVED_NEW) { |
|
133 | 132 | drupal_set_message(t('The crop type %name has been added.', $t_args)); |
134 | 133 | $context = array_merge($t_args, array('link' => $this->l(t('View'), new Url('crop.overview_types')))); |
135 | 134 | $this->logger('crop')->notice('Added crop type %name.', $context); |
@@ -37,8 +37,7 @@ discard block |
||
37 | 37 | try { |
38 | 38 | $crop_type->save(); |
39 | 39 | $this->assertTrue(TRUE, 'Crop type saved correctly.'); |
40 | - } |
|
41 | - catch (\Exception $exception) { |
|
40 | + } catch (\Exception $exception) { |
|
42 | 41 | $this->assertTrue(FALSE, 'Crop type not saved correctly.'); |
43 | 42 | } |
44 | 43 | |
@@ -72,8 +71,7 @@ discard block |
||
72 | 71 | try { |
73 | 72 | $crop->save(); |
74 | 73 | $this->assertTrue(TRUE, 'Crop saved correctly.'); |
75 | - } |
|
76 | - catch (\Exception $exception) { |
|
74 | + } catch (\Exception $exception) { |
|
77 | 75 | $this->assertTrue(FALSE, 'Crop not saved correctly.'); |
78 | 76 | } |
79 | 77 |
@@ -59,8 +59,7 @@ |
||
59 | 59 | try { |
60 | 60 | $provider = $crop->provider(); |
61 | 61 | $this->assertTrue(TRUE, 'File entity provider plugin was found.'); |
62 | - } |
|
63 | - catch (EntityProviderNotFoundException $e) { |
|
62 | + } catch (EntityProviderNotFoundException $e) { |
|
64 | 63 | $this->assertTrue(FALSE, 'File entity provider plugin was found.'); |
65 | 64 | } |
66 | 65 |
@@ -10,7 +10,6 @@ |
||
10 | 10 | use Drupal\Core\Config\Entity\ConfigEntityListBuilder; |
11 | 11 | use Drupal\Core\Entity\Query\QueryFactory; |
12 | 12 | use Drupal\Core\Entity\EntityTypeInterface; |
13 | -use Drupal\Core\StringTranslation\TranslatableMarkup; |
|
14 | 13 | use Symfony\Component\DependencyInjection\ContainerInterface; |
15 | 14 | use Drupal\Core\Entity\EntityStorageInterface; |
16 | 15 | use Drupal\Core\Routing\UrlGeneratorInterface; |
@@ -123,16 +123,16 @@ |
||
123 | 123 | foreach ($this->cropImageStyles as $image_style) { |
124 | 124 | /** @var \Drupal\image\ImageEffectInterface $effect */ |
125 | 125 | foreach ($image_style->getEffects() as $effect) { |
126 | - if (isset($effect->getConfiguration()['data']['crop_type'])) { |
|
127 | - $crop_type = $effect->getConfiguration()['data']['crop_type']; |
|
128 | - if ($crop_type == $entity->id()) { |
|
129 | - // Add two image styles into the usage list. |
|
130 | - if (count($image_styles) < 2) { |
|
131 | - $usage[] = $image_style->link(); |
|
132 | - } |
|
133 | - $image_styles[] = $image_style; |
|
134 | - } |
|
135 | - } |
|
126 | + if (isset($effect->getConfiguration()['data']['crop_type'])) { |
|
127 | + $crop_type = $effect->getConfiguration()['data']['crop_type']; |
|
128 | + if ($crop_type == $entity->id()) { |
|
129 | + // Add two image styles into the usage list. |
|
130 | + if (count($image_styles) < 2) { |
|
131 | + $usage[] = $image_style->link(); |
|
132 | + } |
|
133 | + $image_styles[] = $image_style; |
|
134 | + } |
|
135 | + } |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 |
@@ -139,8 +139,7 @@ |
||
139 | 139 | $other_image_styles = array_splice($image_styles, 2); |
140 | 140 | if ($other_image_styles) { |
141 | 141 | $usage_message = t('@first, @second and @count more', ['@first' => $usage[0], '@second' => $usage[1], '@count' => count($other_image_styles)]); |
142 | - } |
|
143 | - else { |
|
142 | + } else { |
|
144 | 143 | $usage_message = implode(', ', $usage); |
145 | 144 | } |
146 | 145 | $row['usage']['data']['#markup'] = $usage_message; |