diff --git a/README.md b/README.md index 58063ea..4f502ff 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,11 @@ Entity Print allows you to print any Drupal entity or view to PDF. -For a full description visit project page: https://www.drupal.org/project/entity_print +For a full description visit project page: +https://www.drupal.org/project/entity_print -Bug reports, feature suggestions and latest developments: http://drupal.org/project/issues/entity_print +Bug reports, feature suggestions and latest developments: +http://drupal.org/project/issues/entity_print # REQUIREMENTS @@ -12,4 +14,5 @@ Bug reports, feature suggestions and latest developments: http://drupal.org/proj # INSTALLATION -See documentation at https://www.drupal.org/project/entity_print and https://www.drupal.org/node/2706755 +See documentation at https://www.drupal.org/project/entity_print and +https://www.drupal.org/node/2706755 diff --git a/entity_print.install b/entity_print.install index f46ccc7..e2f5f54 100644 --- a/entity_print.install +++ b/entity_print.install @@ -18,12 +18,12 @@ function entity_print_install() { // Add a PDF view mode if the node entity type exists and the PDF view mode // does not already exist. if ($entity_type_manager->getDefinition('node', FALSE) && !$storage->load('node.pdf')) { - $storage->create(array( + $storage->create([ 'targetEntityType' => 'node', 'id' => 'node.pdf', 'status' => TRUE, 'label' => t('PDF'), - ))->save(); + ])->save(); } } diff --git a/entity_print.module b/entity_print.module index 4230820..f57ceca 100644 --- a/entity_print.module +++ b/entity_print.module @@ -16,7 +16,7 @@ use Drupal\entity_print\Renderer\ContentEntityRenderer; * Implements hook_theme(). */ function entity_print_theme($existing, $type, $theme, $path) { - return array( + return [ 'entity_print' => [ 'path' => $path . '/templates', 'template' => 'entity-print', @@ -26,7 +26,7 @@ function entity_print_theme($existing, $type, $theme, $path) { 'entity_print_css' => NULL, ], ], - ); + ]; } /** diff --git a/modules/entity_print_views/tests/modules/entity_print_views_test_views/config/install/views.view.my_test_view.yml b/modules/entity_print_views/tests/modules/entity_print_views_test_views/config/install/views.view.my_test_view.yml index 710b3cc..d34f708 100644 --- a/modules/entity_print_views/tests/modules/entity_print_views_test_views/config/install/views.view.my_test_view.yml +++ b/modules/entity_print_views/tests/modules/entity_print_views_test_views/config/install/views.view.my_test_view.yml @@ -894,4 +894,3 @@ display: - 'user.node_grants:view' - user.permissions tags: { } - diff --git a/src/EntityPrintPermissions.php b/src/EntityPrintPermissions.php index 25c6a38..b5c11cf 100644 --- a/src/EntityPrintPermissions.php +++ b/src/EntityPrintPermissions.php @@ -34,7 +34,7 @@ class EntityPrintPermissions implements ContainerInjectionInterface { * Constructs a new EntityPrintPermissions. * * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager - * The entity manager. + * The entity manager. * @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $entity_type_bundle_info * The entity type bundle info. * @param \Drupal\Core\StringTranslation\TranslationManager $translation_manager diff --git a/src/Form/SettingsForm.php b/src/Form/SettingsForm.php index 90243fa..49e5406 100644 --- a/src/Form/SettingsForm.php +++ b/src/Form/SettingsForm.php @@ -6,7 +6,7 @@ use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Form\ConfigFormBase; use Drupal\entity_print\Plugin\EntityPrintPluginManagerInterface; -use Drupal\entity_print\Plugin\ExportTypeManager; +use Drupal\entity_print\Plugin\ExportTypeManagerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; use Drupal\Core\Form\FormStateInterface; @@ -33,7 +33,7 @@ class SettingsForm extends ConfigFormBase { /** * The export type manager. * - * @var \Drupal\entity_print\Plugin\ExportTypeManager + * @var \Drupal\entity_print\Plugin\ExportTypeManagerInterface */ protected $exportTypeManager; @@ -44,10 +44,12 @@ class SettingsForm extends ConfigFormBase { * The factory for configuration objects. * @param \Drupal\entity_print\Plugin\EntityPrintPluginManagerInterface $plugin_manager * The plugin manager object. + * @param \Drupal\entity_print\Plugin\ExportTypeManagerInterface $export_type_manager + * The export type manager interface. * @param \Drupal\Core\Entity\EntityStorageInterface $entity_storage * The config storage. */ - public function __construct(ConfigFactoryInterface $config_factory, EntityPrintPluginManagerInterface $plugin_manager, ExportTypeManager $export_type_manager, EntityStorageInterface $entity_storage) { + public function __construct(ConfigFactoryInterface $config_factory, EntityPrintPluginManagerInterface $plugin_manager, ExportTypeManagerInterface $export_type_manager, EntityStorageInterface $entity_storage) { parent::__construct($config_factory); $this->pluginManager = $plugin_manager; $this->exportTypeManager = $export_type_manager; diff --git a/src/Plugin/EntityPrint/PrintEngine/PdfEngineBase.php b/src/Plugin/EntityPrint/PrintEngine/PdfEngineBase.php index aa3611c..0d2c107 100644 --- a/src/Plugin/EntityPrint/PrintEngine/PdfEngineBase.php +++ b/src/Plugin/EntityPrint/PrintEngine/PdfEngineBase.php @@ -59,7 +59,7 @@ abstract class PdfEngineBase extends PrintEngineBase { * @return array * An array of paper sizes keyed by their machine name. */ - protected abstract function getPaperSizes(); + abstract protected function getPaperSizes(); /** * {@inheritdoc} diff --git a/src/PrintBuilder.php b/src/PrintBuilder.php index 973e58a..7da7a04 100644 --- a/src/PrintBuilder.php +++ b/src/PrintBuilder.php @@ -39,6 +39,8 @@ class PrintBuilder implements PrintBuilderInterface { * The Renderer factory. * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher * The event dispatcher. + * @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation + * The string translation service. */ public function __construct(RendererFactoryInterface $renderer_factory, EventDispatcherInterface $event_dispatcher, TranslationInterface $string_translation) { $this->rendererFactory = $renderer_factory; diff --git a/src/Tests/EntityPrintActionTest.php b/src/Tests/EntityPrintActionTest.php index 8f6da92..c1bdf52 100644 --- a/src/Tests/EntityPrintActionTest.php +++ b/src/Tests/EntityPrintActionTest.php @@ -24,10 +24,10 @@ class EntityPrintActionTest extends WebTestBase { protected function setUp() { parent::setUp(); // Create a content type and a dummy node. - $this->drupalCreateContentType(array( + $this->drupalCreateContentType([ 'type' => 'page', 'name' => 'Page', - )); + ]); $this->node = $this->drupalCreateNode(); $account = $this->drupalCreateUser([ diff --git a/tests/src/Kernel/EntityPrintAccessTest.php b/tests/src/Kernel/EntityPrintAccessTest.php index 27193ac..6cc1fa1 100644 --- a/tests/src/Kernel/EntityPrintAccessTest.php +++ b/tests/src/Kernel/EntityPrintAccessTest.php @@ -126,7 +126,7 @@ class EntityPrintAccessTest extends KernelTestBase { */ public function testSecondaryEntityTypeAccess() { // User with print entity type user permissions and entity view. - $account = $this->createUser(array('entity print access type user', 'access content')); + $account = $this->createUser(['entity print access type user', 'access content']); $this->assertTrue($this->checkAccess($account, 'user', $account->id()), 'User with "type user" permission and access content permission is allowed to see the content.'); }