/** * Custom Variable directive * * @param string[] $construction * @return string */ public function customvarDirective($construction) { $customVarValue = ''; $params = $this->_getIncludeParameters($construction[2]); if (isset($params['code'])) { $variable = $this->_variableFactory->create()->setStoreId($this->getStoreId())->loadByCode($params['code']); $mode = $this->_plainTemplateMode ? \Magento\Core\Model\Variable::TYPE_TEXT : \Magento\Core\Model\Variable::TYPE_HTML; $value = $variable->getValue($mode); if ($value) { $customVarValue = $value; } } return $customVarValue; }
/** * Retrieve variables to insert into email * * @return array */ public function getVariables() { $variables = array(); $variables[] = $this->_variables->toOptionArray(true); $customVariables = $this->_variableFactory->create()->getVariablesOptionArray(true); if ($customVariables) { $variables[] = $customVariables; } /* @var $template \Magento\Email\Model\Template */ $template = $this->_coreRegistry->registry('current_email_template'); if ($template->getId() && ($templateVariables = $template->getVariablesOptionArray(true))) { $variables[] = $templateVariables; } return $variables; }