Skip to content
Snippets Groups Projects
Commit aa4b2ad4 authored by Boris Doesborg's avatar Boris Doesborg
Browse files

Merge branch '3457871-make-code-pass' into '3.0.x'

Resolve #3457871 "Make code pass"

See merge request !5
parents 50df08ce 8751d94c
No related branches found
No related tags found
No related merge requests found
Pipeline #210992 failed
......@@ -18,12 +18,21 @@ include:
- "/includes/include.drupalci.variables.yml"
- "/includes/include.drupalci.workflows.yml"
# Require tests to pass.
cspell:
allow_failure: false
eslint:
allow_failure: false
phpcs:
allow_failure: false
################
# Pipeline configuration variables are defined with default values and descriptions in the file
# https://git.drupalcode.org/project/gitlab_templates/-/blob/main/includes/include.drupalci.variables.yml
# Uncomment the lines below if you want to override any of the variables. The following is just an example.
################
# variables:
# SKIP_ESLINT: '1'
# OPT_IN_TEST_NEXT_MAJOR: '1'
# _CURL_TEMPLATES_REF: 'main'
variables:
SKIP_ESLINT: '1'
OPT_IN_TEST_NEXT_MAJOR: '1'
_CURL_TEMPLATES_REF: 'main'
_CSPELL_WORDS: 'fabianderijk,Rijk'
......@@ -26,10 +26,12 @@ class ConfigForm extends ConfigFormBase {
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The factory for configuration objects.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager;
* The entity type manager;.
*/
public function __construct(ConfigFactoryInterface $config_factory,
EntityTypeManagerInterface $entity_type_manager) {
public function __construct(
ConfigFactoryInterface $config_factory,
EntityTypeManagerInterface $entity_type_manager,
) {
parent::__construct($config_factory);
$this->menuStorage = $entity_type_manager->getStorage('menu');
}
......
......@@ -2,8 +2,8 @@
namespace Drupal\rest_menu_items\Plugin\rest\resource;
use Drupal\Core\Cache\CacheableDependencyInterface;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheableDependencyInterface;
/**
* The cacheable dependency class.
......
......@@ -7,19 +7,18 @@ use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\File\FileUrlGeneratorInterface;
use Drupal\Core\Menu\MenuTreeParameters;
use Drupal\Core\Menu\MenuLinkInterface;
use Drupal\Core\Menu\MenuTreeParameters;
use Drupal\Core\Url;
use Drupal\field\FieldConfigInterface;
use Drupal\file\Entity\File;
use Drupal\path_alias\AliasManagerInterface;
use Drupal\rest\Plugin\ResourceBase;
use Drupal\rest\ModifiedResourceResponse;
use Drupal\Core\Url;
use Drupal\rest\Plugin\ResourceBase;
use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Psr\Log\LoggerInterface;
/**
* Provides a resource to get bundles by entity.
......@@ -482,7 +481,9 @@ class RestMenuItemsResource extends ResourceBase {
* Check if there are any additional fields added to MenuLink.
*
* @param \Drupal\Core\Menu\MenuLinkInterface $menu_link
* Menu link.
* @param array $newValue
* Child elements.
*/
protected function checkContentFields(MenuLinkInterface $menu_link, array &$newValue) {
$plugin_definition = $menu_link->getPluginDefinition();
......@@ -510,7 +511,7 @@ class RestMenuItemsResource extends ResourceBase {
}
elseif ($field_definition->getType() == 'image') {
$image_urls = [];
foreach ($menu_link_content->get($field_name)->getValue() as $fids){
foreach ($menu_link_content->get($field_name)->getValue() as $fids) {
$file = File::load($fids['target_id']);
$image_urls[]['value'] = Url::fromUri($this->fileUrlGenerator->generateAbsoluteString($file->getFileUri()))->toString();
}
......@@ -519,9 +520,9 @@ class RestMenuItemsResource extends ResourceBase {
else {
$field_value = $menu_link_content->get($field_name)->getValue();
}
// @todo: add proper normalizing.
// @todo: render the values of the fields, as simply the referenced
// entity ID doesn't do much for the client using the endpoint.
// @todo add proper normalizing.
// @todo render the values of the fields, as simply the referenced
// entity ID doesn't do much for the client using the endpoint.
$normalized_value = NULL;
if (!empty($field_value)) {
$normalized_value = $field_value;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment