Skip to content

Commit 59810c5

Browse files
committed
Removed logic to have field_formatters control block display. Hard code options of addthis_basic_toolbox and addthis_basic_button for the time being.
1 parent 643f60e commit 59810c5

File tree

3 files changed

+4
-29
lines changed

3 files changed

+4
-29
lines changed

addthis.module

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,4 @@ function addthis_theme() {
2020
];
2121
}
2222

23-
/**
24-
* Implementation to retrieve formatters for a given type of field.
25-
*/
26-
function _addthis_field_info_formatter_field_type($field_type = NULL) {
27-
$formatters = \Drupal::Service('plugin.manager.field.formatter')
28-
->getDefinitions();
29-
foreach ($formatters as $key => $formatter) {
30-
if (!in_array((!isset($field_type) ? 'addthis' : $field_type), $formatter['field_types'])) {
31-
unset($formatters[$key]);
32-
}
33-
}
34-
return $formatters;
35-
}
36-
3723

addthis_block/src/Plugin/Block/AddThisBlock.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,6 @@ public function defaultConfiguration() {
4040
* {@inheritdoc}
4141
*/
4242
function blockForm($form, FormStateInterface $form_state) {
43-
44-
// The list of formatters.
45-
$add_this_service = \Drupal::service('addthis.addthis');
46-
$formatter_options = $add_this_service->getDisplayTypes();
47-
48-
4943
$settings = $this->getConfiguration();
5044

5145
$type = $settings['type'];
@@ -74,7 +68,10 @@ function blockForm($form, FormStateInterface $form_state) {
7468
'#type' => 'select',
7569
'#title' => t('Formatter for @title', array('@title' => 'AddThis block')),
7670
'#title_display' => 'invisible',
77-
'#options' => $formatter_options,
71+
'#options' => [
72+
'addthis_basic_button',
73+
'addthis_basic_toolbox'
74+
],
7875
'#default_value' => $settings['type'],
7976
'#attributes' => array('class' => array('addthis-display-type')),
8077
'#ajax' => array(

src/AddThis.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,5 @@ private function getProfileIdQueryParameterPrefixedWithHash() {
246246
}
247247

248248

249-
public function getDisplayTypes() {
250-
$displays = array();
251-
foreach ($display_impl = _addthis_field_info_formatter_field_type() as $key => $display) {
252-
$displays[$key] = t(SafeMarkup::checkPlain($display['label']));
253-
}
254-
return $displays;
255-
}
256-
257249

258250
}

0 commit comments

Comments
 (0)