' . t('About') . ''; $output .= '
' . t('The Diff module replaces the normal Revisions node tab and enhances the listing of revisions with an option to view the differences between any two content revisions.') . '
'; $output .= '' . t('Configurations for the revision comparison functionality and diff layout plugins.') . '
'; case 'diff.revision_overview': return '' . t('Revisions allow you to track differences between multiple versions of your content, and revert to older versions.') . '
'; case 'diff.fields_list': return '' . t('This table provides a summary of the field support found on the system. For every field, a diff plugin can be selected and configured. These settings are applied to Unified and Split fields layouts.') . '
'; } } /** * Returns the label of a certain field. * * Therefore it looks up in all bundles to find the most used field. * * @param string $entity_type * The entity type id. * @param string $field_name * The field name. * * @return array * Array of labels used for the field sorted by the most used. */ function _diff_field_label($entity_type, $field_name) { $labels = []; // Count the amount of instances of each label per field storage. $bundles = \Drupal::service('entity_type.bundle.info')->getBundleInfo($entity_type); $field_manager = \Drupal::service('entity_field.manager'); foreach (array_keys($bundles) as $bundle) { $bundle_instances = $field_manager->getFieldDefinitions($entity_type, $bundle); if (isset($bundle_instances[$field_name])) { $instance = $bundle_instances[$field_name]; $label = (string) $instance->getLabel(); $labels[$label] = isset($labels[$label]) ? ++$labels[$label] : 1; } } if (empty($labels)) { // Return the original field name if there is no other label found. return [$field_name]; } // Return the labels sorted by the most used. arsort($labels); return array_keys($labels); }