Skip to content
Snippets Groups Projects

Fixed phpcs issues.

Open Sidharth Soman requested to merge issue/pager-3372282:3372282-phpcs into 3.0.x
3 files
+ 61
5
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -10,7 +10,6 @@ use Drupal\Core\Image\ImageFactory;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Routing\CurrentRouteMatch;
use Drupal\Core\Url;
use Drupal\image\Entity\ImageStyle;
use Drupal\pager\PagerStorage;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -23,9 +22,32 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* )
*/
class PagerBlock extends BlockBase implements ContainerFactoryPluginInterface {
/**
* The database handle.
*
* @var dbh
*/
protected $dbh;
/**
* The entity type manager object.
*
* @var entityMgr
*/
protected $entityMgr;
/**
* The image factory object.
*
* @var imgFactory
*/
protected $imgFactory;
/**
* The routing object.
*
* @var route
*/
protected $route;
/**
@@ -320,7 +342,7 @@ class PagerBlock extends BlockBase implements ContainerFactoryPluginInterface {
$fields = [];
foreach ($this->dbh->selectImgData() as $data) {
$obj = (object) unserialize($data);
$obj = (object) unserialize($data, ['allowed_classes' => FALSE]);
if (empty($obj->field_type) || $obj->field_type != 'image') {
continue;
@@ -350,7 +372,7 @@ class PagerBlock extends BlockBase implements ContainerFactoryPluginInterface {
}
$field = $node ? $node->get($this->configuration['field'])->getValue() : [['target_id' => 0]];
$file = !empty($field[0]['target_id']) ? $this->entityMgr->getStorage('file')->load($field[0]['target_id']) : NULL;
$uri = $file ? ImageStyle::load($this->configuration['style'])->buildUri($file->getFileUri()) : '';
$uri = $file ? $this->entityMgr->getStorage('image_style')->load($this->configuration['style'])->buildUri($file->getFileUri()) : '';
$img = $uri ? $this->imgFactory->get($uri) : NULL;
if (!empty($img) && $img->isValid()) {
@@ -374,7 +396,7 @@ class PagerBlock extends BlockBase implements ContainerFactoryPluginInterface {
protected function getImgStyles() {
$styles = [];
foreach (ImageStyle::loadMultiple() as $key => $style) {
foreach ($this->entityMgr->getStorage('image_style')->loadMultiple() as $key => $style) {
$styles[$key] = $style->get('label');
}
return $styles;
@@ -396,7 +418,7 @@ class PagerBlock extends BlockBase implements ContainerFactoryPluginInterface {
$img = $node ? $node->get($this->configuration['field'])->getValue() : [['target_id' => 0]];
$file = !empty($img[0]['target_id']) ? $this->entityMgr->getStorage('file')->load($img[0]['target_id']) : NULL;
return $file ? ImageStyle::load($this->configuration['style'])->buildUrl($file->getFileUri()) : '';
return $file ? $this->entityMgr->getStorage('image_style')->load($this->configuration['style'])->buildUrl($file->getFileUri()) : '';
}
/**
Loading