mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-10-20 17:49:20 +02:00
30 lines
743 B
PHP
30 lines
743 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Api\Field\Wiki\Image;
|
|
|
|
use App\Http\Api\Field\StringField;
|
|
use App\Http\Api\Query\Query;
|
|
use App\Http\Api\Schema\Schema;
|
|
use App\Models\Wiki\Image;
|
|
|
|
class ImagePathField extends StringField
|
|
{
|
|
public function __construct(Schema $schema)
|
|
{
|
|
parent::__construct($schema, Image::ATTRIBUTE_PATH);
|
|
}
|
|
|
|
public function shouldSelect(Query $query, Schema $schema): bool
|
|
{
|
|
$criteria = $query->getFieldCriteria($this->schema->type());
|
|
// The link field is dependent on this field to build the url.
|
|
if (parent::shouldSelect($query, $schema)) {
|
|
return true;
|
|
}
|
|
|
|
return $criteria->isAllowedField(Image::ATTRIBUTE_LINK);
|
|
}
|
|
}
|