Channels   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 36
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A _prepareLayout() 0 8 2
A _getElementHtml() 0 11 1
1
<?php
2
/**
3
 * Slack.com Integration
4
 *
5
 * PHP Version 5
6
 *
7
 * @category  Steverobbins
8
 * @package   Steverobbins_Slack
9
 * @author    Steve Robbins <[email protected]>
10
 * @copyright Copyright 2015 Steve Robbins (http://steverobbins.com)
11
 * @license   http://creativecommons.org/licenses/by/3.0/deed.en_US Creative Commons Attribution 3.0 Unported License
12
 */
13
14
/**
15
 * System config block for channels
16
 */
17
class Steverobbins_Slack_Block_Adminhtml_System_Config_Channels
18
    extends Mage_Adminhtml_Block_System_Config_Form_Field
19
{
20
    /**
21
     * Set template to itself
22
     *
23
     * @return Steverobbins_Slack_Block_Adminhtml_System_Config_Channels
24
     */
25
    protected function _prepareLayout()
26
    {
27
        parent::_prepareLayout();
28
        if (!$this->getTemplate()) {
29
            $this->setTemplate('steverobbins/slack/system/config/channels.phtml');
30
        }
31
        return $this;
32
    }
33
34
    /**
35
     * Renderm html
36
     *
37
     * @param Varien_Data_Form_Element_Abstract $element
38
     *
39
     * @return string
40
     */
41
    protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
42
    {
43
        $originalData = $element->getOriginalData();
44
        $this->addData(array(
45
            'button_label' => Mage::helper('slack')->__($originalData['button_label']),
46
            'html_id'      => $element->getHtmlId(),
47
            'ajax_url'     => Mage::getSingleton('adminhtml/url')->getUrl('*/slack_system_config_channels/get'),
48
            'list_html'  => $this->getLayout()->createBlock('slack/adminhtml_system_config_channels_list')->toHtml()
49
        ));
50
        return $this->_toHtml();
51
    }
52
}
53