N98\Magento\Command\Developer\EmailTemplate\UsageCommand::findEmailTemplates PHP Method

findEmailTemplates() protected method

protected findEmailTemplates ( )
    protected function findEmailTemplates()
    {
        /** @var Mage_Core_Model_Template[] $templates */
        $templates = Mage::getModel('adminhtml/email_template')->getCollection();
        $return = array();
        foreach ($templates as $template) {
            /**
             * Some modules overload the template class so that the method getSystemConfigPathsWhereUsedCurrently
             * is not available, this is a workaround for that
             */
            if (!method_exists($template, 'getSystemConfigPathsWhereUsedCurrently')) {
                $instance = new Mage_Adminhtml_Model_Email_Template();
                $template = $instance->load($template->getId());
            }
            $configPaths = $template->getSystemConfigPathsWhereUsedCurrently();
            if (!count($configPaths)) {
                $configPaths[] = array('scope' => 'Unused', 'scope_id' => 'Unused', 'path' => 'Unused');
            }
            foreach ($configPaths as $configPath) {
                $return[] = array('id' => $this->sanitizeEmailProperty($template->getId()), 'Template Code' => $this->sanitizeEmailProperty($template->getTemplateCode()), 'Scope' => $this->sanitizeEmailProperty($configPath['scope']), 'Scope Id' => $this->sanitizeEmailProperty($configPath['scope_id']), 'Path' => $this->sanitizeEmailProperty($configPath['path']));
            }
        }
        return $return;
    }