Prado\Web\UI\WebControls\TTemplateColumn::initializeCell PHP Method

initializeCell() public method

This method overrides the parent implementation. It initializes the cell based on different templates (ItemTemplate, EditItemTemplate, HeaderTemplate, FooterTemplate).
public initializeCell ( $cell, $columnIndex, $itemType )
    public function initializeCell($cell, $columnIndex, $itemType)
    {
        if ($itemType === TListItemType::Item || $itemType === TListItemType::AlternatingItem || $itemType === TListItemType::SelectedItem || $itemType === TListItemType::EditItem) {
            if ($itemType === TListItemType::EditItem) {
                if (($classPath = $this->getEditItemRenderer()) === '' && ($template = $this->_editItemTemplate) === null) {
                    $classPath = $this->getItemRenderer();
                    $template = $this->_itemTemplate;
                }
            } else {
                $template = $this->_itemTemplate;
                $classPath = $this->getItemRenderer();
            }
            if ($classPath !== '') {
                $control = Prado::createComponent($classPath);
                $cell->getControls()->add($control);
                if ($control instanceof IItemDataRenderer) {
                    $control->setItemIndex($cell->getParent()->getItemIndex());
                    $control->setItemType($itemType);
                }
                if ($control instanceof \Prado\IDataRenderer) {
                    $control->attachEventHandler('OnDataBinding', array($this, 'dataBindColumn'));
                }
            } else {
                if ($template !== null) {
                    $template->instantiateIn($cell);
                } else {
                    if ($itemType !== TListItemType::EditItem) {
                        $cell->setText(' ');
                    }
                }
            }
        } else {
            if ($itemType === TListItemType::Header) {
                if (($classPath = $this->getHeaderRenderer()) !== '') {
                    $this->initializeHeaderCell($cell, $columnIndex);
                } else {
                    if ($this->_headerTemplate !== null) {
                        $this->_headerTemplate->instantiateIn($cell);
                    } else {
                        $this->initializeHeaderCell($cell, $columnIndex);
                    }
                }
            } else {
                if ($itemType === TListItemType::Footer) {
                    if (($classPath = $this->getFooterRenderer()) !== '') {
                        $this->initializeFooterCell($cell, $columnIndex);
                    } else {
                        if ($this->_footerTemplate !== null) {
                            $this->_footerTemplate->instantiateIn($cell);
                        } else {
                            $this->initializeFooterCell($cell, $columnIndex);
                        }
                    }
                }
            }
        }
    }