Skip to content
This repository has been archived by the owner on Mar 29, 2022. It is now read-only.

Commit

Permalink
Issue #3165625 by daniel.bosen, chr.fritsch: Node overwrites do not w…
Browse files Browse the repository at this point in the history
…ork in combination with taxonoym overrides
  • Loading branch information
dbosen authored Aug 17, 2020
1 parent 03e2486 commit 597a6d3
Show file tree
Hide file tree
Showing 23 changed files with 772 additions and 60 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/module-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Run module tests

on:
pull_request:
paths-ignore:
- '**.md'

schedule:
- cron: '0 6 * * *'

env:
DRUPAL_TESTING_TEST_CODING_STYLES: false
DRUPAL_TESTING_DATABASE_USER: root
DRUPAL_TESTING_DATABASE_PASSWORD: root
DRUPAL_TESTING_DATABASE_ENGINE: mysql
DRUPAL_TESTING_DRUPAL_VERSION: '~8.8.0'

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
PHP: ['7.3', '7.4']

steps:
- uses: actions/checkout@v1

- uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: ${{ matrix.PHP }}

- name: Start MySql service
run: sudo /etc/init.d/mysql start

- name: Cache composer dependencies
uses: actions/cache@v1
with:
path: ~/.composer/cache
key: ${{ runner.os }}-composer-cache-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-cache-

- name: Get build environment
run: composer global require thunder/drupal-testing

- name: Run the tests
run: test-drupal-project
39 changes: 39 additions & 0 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Check coding styles

on: [pull_request]

jobs:
eslint:
name: runner / eslint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1

- name: eslint
uses: reviewdog/action-eslint@v1
with:
github_token: ${{ secrets.github_token }}

phpcs:
name: runner / phpcs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1

- name: phpcs
uses: chrfritsch/action-drupal-coder@v1
with:
github_token: ${{ secrets.github_token }}
level: error

misspell:
name: runner / misspell
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: reviewdog/action-misspell@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-check
level: warning
locale: "US"
33 changes: 0 additions & 33 deletions .travis.yml

This file was deleted.

3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"license": "GPL-2.0-or-later",
"minimum-stability": "dev",
"require": {
"drupal/breakpoint_js_settings": "~1.0"
"drupal/breakpoint_js_settings": "~1.0",
"drupal/token": "^1.7"
},
"require-dev": {
"burdamagazinorg/thunder-dev-tools": "dev-master"
Expand Down
66 changes: 52 additions & 14 deletions config/schema/ivw_integration.schema.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
field.value.ivw_integration_settings:
type: mapping
label: 'Default value'
mapping:
offering:
type: string
label: 'Offering'
language:
type: string
label: 'Language'
frabo:
type: string
label: 'Frabo'
frabo_mobile:
type: string
label: 'Frabo mobile'
format:
type: string
label: 'Format'
creator:
type: string
label: 'Creator'
homepage:
type: string
label: 'Homepage'
delivery:
type: string
label: 'Delivery'
app:
type: string
label: 'App'
paid:
type: string
label: 'Paid'
content:
type: string
label: 'Content'

ivw_integration.settings:
type: config_object
label: 'IVW Settings'
Expand All @@ -24,38 +62,38 @@ ivw_integration.settings:
type: boolean
label: 'Offering setting is overridable'
language_default:
type: integer
label: 'Default language code'
type: integer
label: 'Default language code'
language_overridable:
type: boolean
label: 'Language setting is overridable'
format_default:
type: integer
label: 'Default format code'
type: integer
label: 'Default format code'
format_overridable:
type: boolean
label: 'Format setting is overridable'
creator_default:
type: integer
label: 'Default creator code'
type: integer
label: 'Default creator code'
creator_overridable:
type: boolean
label: 'Creator setting is overridable'
homepage_default:
type: integer
label: 'Default homepage code'
type: integer
label: 'Default homepage code'
homepage_overridable:
type: boolean
label: 'Homepage setting is overridable'
delivery_default:
type: integer
label: 'Default delivery code'
type: integer
label: 'Default delivery code'
delivery_overridable:
type: boolean
label: 'Delivery setting is overridable'
app_default:
type: integer
label: 'Default app flag'
type: integer
label: 'Default app flag'
app_overridable:
type: boolean
label: 'App setting is overridable'
Expand All @@ -66,8 +104,8 @@ ivw_integration.settings:
type: boolean
label: 'Paid setting is overridable'
content_default:
type: string
label: 'Default content code'
type: string
label: 'Default content code'
content_overridable:
type: boolean
label: 'Content setting is overridable'
Expand Down
14 changes: 6 additions & 8 deletions src/IvwLookupService.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ public function byTerm($name, TermInterface $term, $parentOnly = FALSE) {
* The property value.
*/
protected function searchEntity($name, ContentEntityInterface $entity, $parentOnly = FALSE) {
$termOverride = NULL;
// Search for ivw_integration_settings field.
foreach ($entity->getFieldDefinitions() as $fieldDefinition) {
$fieldType = $fieldDefinition->getType();
Expand All @@ -246,14 +247,15 @@ protected function searchEntity($name, ContentEntityInterface $entity, $parentOn
* If settings are found, check if an overridden value for the
* given setting is found and return that
*/
$overiddenSetting = $this->getOverriddenIvwSetting($name, $fieldDefinition, $entity);
$overiddenSetting = $this->getOverriddenIvwSetting($name,
$fieldDefinition, $entity);
if (isset($overiddenSetting)) {
return $overiddenSetting;
}
}

// Check for fallback categories if no ivw_integration_setting is found.
if ($fieldType === 'entity_reference' && $fieldDefinition->getSetting('target_type') === 'taxonomy_term') {
if (!isset($termOverride) && $fieldType === 'entity_reference' && $fieldDefinition->getSetting('target_type') === 'taxonomy_term') {
$fieldName = $fieldDefinition->getName();
if ($tid = $entity->$fieldName->target_id) {
/** @var \Drupal\taxonomy\TermInterface $term */
Expand All @@ -265,14 +267,10 @@ protected function searchEntity($name, ContentEntityInterface $entity, $parentOn
}
}
}

// Return found termOverride.
if (isset($termOverride)) {
return $termOverride;
}
}

return NULL;
// Return found termOverride.
return $termOverride ?? NULL;
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
langcode: en
status: true
dependencies:
module:
- ivw_integration
theme:
- stark
id: ivwcall
theme: stark
region: header
weight: 0
provider: null
plugin: ivw_integration_call_block
settings:
id: ivw_integration_call_block
label: 'IVW call'
provider: ivw_integration
label_display: visible
visibility: { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
langcode: en
status: true
dependencies:
config:
- field.field.node.ivw_test.field_a
- field.field.node.ivw_test.field_ivw_settings
- field.field.node.ivw_test.field_z
- node.type.ivw_test
module:
- ivw_integration
id: node.ivw_test.default
targetEntityType: node
bundle: ivw_test
mode: default
content:
created:
type: datetime_timestamp
weight: 2
region: content
settings: { }
third_party_settings: { }
field_a:
weight: 26
settings: { }
third_party_settings: { }
type: options_select
region: content
field_ivw_settings:
type: ivw_integration_widget
weight: 6
region: content
settings: { }
third_party_settings: { }
field_z:
weight: 27
settings: { }
third_party_settings: { }
type: options_select
region: content
promote:
type: boolean_checkbox
settings:
display_label: true
weight: 3
region: content
third_party_settings: { }
status:
type: boolean_checkbox
settings:
display_label: true
weight: 5
region: content
third_party_settings: { }
sticky:
type: boolean_checkbox
settings:
display_label: true
weight: 4
region: content
third_party_settings: { }
title:
type: string_textfield
weight: 0
region: content
settings:
size: 60
placeholder: ''
third_party_settings: { }
uid:
type: entity_reference_autocomplete
weight: 1
settings:
match_operator: CONTAINS
size: 60
placeholder: ''
match_limit: 10
region: content
third_party_settings: { }
hidden: { }
Loading

0 comments on commit 597a6d3

Please sign in to comment.