function sharethis_entity_extra_field_info in ShareThis 8.2
Implements hook_entity_extra_field_info().
File
- ./
sharethis.module, line 51 - A module that adds one of the ShareThis widget to your website.
Code
function sharethis_entity_extra_field_info() {
$sharethis_settings = \Drupal::config('sharethis.settings');
$extra = [];
// Only add extra fields if the location is the node content.
if ($sharethis_settings
->get('location') == 'content') {
$entity_info = \Drupal::service('entity_type.bundle.info')
->getAllBundleInfo();
if (isset($entity_info['node'])) {
foreach ($entity_info['node'] as $bundle => $bundle_info) {
$extra['node'][$bundle]['display'] = [
'sharethis' => [
'label' => t('ShareThis'),
'description' => t('ShareThis links'),
'weight' => $sharethis_settings
->get('weight'),
],
];
}
}
}
return $extra;
}