objectManager = $objectManager; $this->storeManager = $storeManager; parent::__construct($context); } public function getConfigValue($field, $storeId = null) { return $this->scopeConfig->getValue( $field, ScopeInterface::SCOPE_STORE, $storeId ); } public function getGeneralConfig($code, $storeId = null) { return $this->getConfigValue(self::XML_PATH_RETAILCRM . $code, $storeId); } /** * Recursive array filter * * @param array $haystack input array * * @SuppressWarnings(PHPMD.StaticAccess) * @SuppressWarnings(PHPMD.ElseExpression) * * @return array */ public function filterRecursive($haystack) { foreach ($haystack as $key => $value) { if (is_array($value)) { $haystack[$key] = self::filterRecursive($haystack[$key]); } if (is_null($haystack[$key]) || $haystack[$key] === '' || count($haystack[$key]) == 0 ) { unset($haystack[$key]); } elseif (!is_array($value)) { $haystack[$key] = trim($value); } } return $haystack; } }