Skip to content

Commit b13fac8

Browse files
committed
Add support for template context Access rules in PageImageSizeField.
1 parent da23b45 commit b13fac8

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/Field/PageImage/PageImageSizeField.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ public function build(FieldConfig $config)
4141

4242
public function resolve($value, array $args, ResolveInfo $info)
4343
{
44-
$canCreate = Utils::moduleConfig()->legalEditFields->has($value->field);
44+
$legalFields = Utils::moduleConfig()->legalFields;
45+
$canCreate = Utils::hasFieldPermission('edit', $value->field, Utils::moduleConfig()->currentTemplateContext);
4546
$width = isset($args['width']) ? $args['width'] : null;
4647
$height = isset($args['height']) ? $args['height'] : null;
4748

src/Field/TemplatedPageArray/TemplatedPageArrayField.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Youshido\GraphQL\Field\AbstractField;
66
use Youshido\GraphQL\Execution\ResolveInfo;
77
use ProcessWire\Template;
8+
use Processwire\GraphQL\Utils;
89
use ProcessWire\GraphQL\Type\Object\TemplatedPageArrayType;
910
use ProcessWire\GraphQL\Type\Scalar\TemplatedSelectorType;
1011
use ProcessWire\GraphQL\Field\Traits\OptionalTemplatedSelectorTrait;
@@ -40,6 +41,7 @@ public function getDescription()
4041

4142
public function resolve($value, array $args, ResolveInfo $info)
4243
{
44+
Utils::moduleConfig()->currentTemplateContext = $this->template;
4345
$pages = \Processwire\wire('pages');
4446
return $pages->find($args[TemplatedSelectorType::ARGUMENT_NAME]);
4547
}

0 commit comments

Comments
 (0)