From 40b685a4c2d2c923af93b80c424c274ed0e602af Mon Sep 17 00:00:00 2001 From: Andriy Iun Date: Fri, 14 Feb 2020 15:45:35 +0100 Subject: [PATCH 1/4] Added more memory for Travis --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 505e9edb..4e29baec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,9 @@ sudo: false php: - 7.2 +before_install: + - echo "memory_limit=2G" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini + install: - composer global require drush/drush:8.x-dev drupal/coder mglaman/drupal-check friendsoftwig/twigcs - export PATH="$HOME/.config/composer/vendor/bin:$PATH" From 07c2374378fc1d6bddd72010eaabb6234b53dc19 Mon Sep 17 00:00:00 2001 From: Andriy Iun Date: Fri, 14 Feb 2020 15:46:52 +0100 Subject: [PATCH 2/4] Added parallel composer install plugin --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 4e29baec..4d72d98b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,7 @@ before_install: - echo "memory_limit=2G" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini install: + - composer global require hirak/prestissimo - composer global require drush/drush:8.x-dev drupal/coder mglaman/drupal-check friendsoftwig/twigcs - export PATH="$HOME/.config/composer/vendor/bin:$PATH" - phpcs --config-set installed_paths ../../drupal/coder/coder_sniffer From 6bbadabbd3bf92d945710e36aafac1ac052e479b Mon Sep 17 00:00:00 2001 From: juuliabellcom Date: Thu, 12 Mar 2020 22:22:20 +0200 Subject: [PATCH 3/4] MOC-813-85849 Issue with SBSYS component --- .../src/Element/WebformAttachmentSbsysXml.php | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/modules/os2forms_sbsys/src/Element/WebformAttachmentSbsysXml.php b/modules/os2forms_sbsys/src/Element/WebformAttachmentSbsysXml.php index 0d21a47f..2bb6a1f9 100644 --- a/modules/os2forms_sbsys/src/Element/WebformAttachmentSbsysXml.php +++ b/modules/os2forms_sbsys/src/Element/WebformAttachmentSbsysXml.php @@ -179,14 +179,39 @@ protected static function getFirstValueByType($type, WebformSubmissionInterface $webform = $webform_submission->getWebform(); $webform_elements = $webform->getElementsDecoded(); foreach ($webform_elements as $key => $webform_element) { - if ($webform_element['#type'] == $type) { - $value = $webform_submission->getElementData($key); + if ($el_key = self::getElementKeyByType($webform_element, $type, $key)){ + $value = $webform_submission->getElementData($el_key); break; } } return $value; } + /** + * Gets key of first element by field type. + * + * @param string $type + * Element value type. + * @param \Drupal\webform\WebformSubmissionInterface $webform_submission + * A webform submission. + * @param string $el_key + * Current element key. + * + * @return mixed + * Element key. + */ + protected static function getElementKeyByType($webform_element, $type, $el_key) { + foreach($webform_element as $key => $value) { + if ($key == '#type' && $value == $type) { + return $el_key; + } + else if(is_array($value)) { + return self::getElementKeyByType($value, $type, $key); + } + } + return FALSE; + } + /** * Helper function the returns the list of the fields + values as an array. * From c429feb7d80f2344b3842f36cc833512fb99abd5 Mon Sep 17 00:00:00 2001 From: Stanislav Kutasevits Date: Fri, 13 Mar 2020 11:50:52 +0200 Subject: [PATCH 4/4] Formatting and PHPDoc --- .../src/Element/WebformAttachmentSbsysXml.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/os2forms_sbsys/src/Element/WebformAttachmentSbsysXml.php b/modules/os2forms_sbsys/src/Element/WebformAttachmentSbsysXml.php index 2bb6a1f9..513873d9 100644 --- a/modules/os2forms_sbsys/src/Element/WebformAttachmentSbsysXml.php +++ b/modules/os2forms_sbsys/src/Element/WebformAttachmentSbsysXml.php @@ -179,7 +179,7 @@ protected static function getFirstValueByType($type, WebformSubmissionInterface $webform = $webform_submission->getWebform(); $webform_elements = $webform->getElementsDecoded(); foreach ($webform_elements as $key => $webform_element) { - if ($el_key = self::getElementKeyByType($webform_element, $type, $key)){ + if ($el_key = self::getElementKeyByType($webform_element, $type, $key)) { $value = $webform_submission->getElementData($el_key); break; } @@ -190,22 +190,22 @@ protected static function getFirstValueByType($type, WebformSubmissionInterface /** * Gets key of first element by field type. * + * @param array $webform_element + * The element of the webform. * @param string $type * Element value type. - * @param \Drupal\webform\WebformSubmissionInterface $webform_submission - * A webform submission. * @param string $el_key * Current element key. * * @return mixed * Element key. */ - protected static function getElementKeyByType($webform_element, $type, $el_key) { - foreach($webform_element as $key => $value) { + protected static function getElementKeyByType(array $webform_element, $type, $el_key) { + foreach ($webform_element as $key => $value) { if ($key == '#type' && $value == $type) { return $el_key; } - else if(is_array($value)) { + elseif (is_array($value)) { return self::getElementKeyByType($value, $type, $key); } }