Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[API] Add liip image filters to API #12862

Merged
merged 5 commits into from
Aug 6, 2021

Conversation

arti0090
Copy link
Contributor

@arti0090 arti0090 commented Aug 5, 2021

Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Related tickets PR with PoC: #12798
License MIT

At the moment it adds 'filtered_path' with normal 'path'.
image

You can choose filter from list
image

@arti0090 arti0090 requested a review from a team as a code owner August 5, 2021 07:31
@probot-autolabeler probot-autolabeler bot added the API APIs related issues and PRs. label Aug 5, 2021
Comment on lines +37 to +49
return $this->removeAdminFilters($filters);
}

private function removeAdminFilters(array $filters): array {
/** @var string $filter */
foreach ($filters as $key => $filter) {
if (str_contains($key, 'admin')) {
unset($filters[$key]);
}
}

return $filters;
}
Copy link
Contributor

@stloyd stloyd Aug 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return $this->removeAdminFilters($filters);
}
private function removeAdminFilters(array $filters): array {
/** @var string $filter */
foreach ($filters as $key => $filter) {
if (str_contains($key, 'admin')) {
unset($filters[$key]);
}
}
return $filters;
}
return array_filter($filters, function ($key) {
return str_contains($key, 'admin');
}, ARRAY_FILTER_USE_KEY);
}

Comment on lines +2 to +7
"@context": "\/api\/v2\/contexts\/ProductImage",
"@id": "\/api\/v2\/shop\/product-images\/@integer@",
"@type": "ProductImage",
"id": "@integer@",
"type": "thumbnail",
"path": "@string@\/media\/cache\/resolve\/sylius_small\/uo\/product.jpg"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use 4 spaces instead of 2 as indentation

{
$fixtures = $this->loadFixturesFromFiles(['product_image.yaml', 'authentication/api_administrator.yaml']);
/** @var ProductImageInterface $productImage */
$productImage = $fixtures["product_thumbnail"];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$productImage = $fixtures["product_thumbnail"];
$productImage = $fixtures['product_thumbnail'];

@GSadee GSadee merged commit 9a49633 into Sylius:master Aug 6, 2021
@GSadee
Copy link
Member

GSadee commented Aug 6, 2021

Thanks, @arti0090! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API APIs related issues and PRs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants