Created
September 26, 2012 15:52
-
-
Save ceckoslab/3788828 to your computer and use it in GitHub Desktop.
This is just a modified version of the function Mage_Adminhtml_Model_Email_Template::getSystemConfigPathsWhereUsedCurrently() and it returns all the used email templates configuration paths
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Collect all email templates system config paths | |
* | |
* @return array | |
*/ | |
public function getEmailTemplatesSystemConfigPaths() | |
{ | |
$paths = array(); | |
$configSections = Mage::getSingleton('adminhtml/config')->getSections(); | |
// look for node entries in all system.xml that use source_model=adminhtml/system_config_source_email_template | |
// they are will be templates, what we try find | |
$sysCfgNodes = $configSections->xpath(Mage_Adminhtml_Model_Email_Template::XML_PATH_TEMPLATE_EMAIL); | |
if (!is_array($sysCfgNodes)) { | |
return array(); | |
} | |
foreach ($sysCfgNodes as $fieldNode) { | |
$groupNode = $fieldNode->getParent()->getParent(); | |
$sectionNode = $groupNode->getParent()->getParent(); | |
// create email template path in system.xml | |
$sectionName = $sectionNode->getName(); | |
$groupName = $groupNode->getName(); | |
$fieldName = $fieldNode->getName(); | |
$paths[] = implode('/', array($sectionName, $groupName, $fieldName)); | |
} | |
return $paths; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment