本文整理汇总了PHP中Kwc_Abstract_Form::createComponentForm方法的典型用法代码示例。如果您正苦于以下问题:PHP Kwc_Abstract_Form::createComponentForm方法的具体用法?PHP Kwc_Abstract_Form::createComponentForm怎么用?PHP Kwc_Abstract_Form::createComponentForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kwc_Abstract_Form
的用法示例。
在下文中一共展示了Kwc_Abstract_Form::createComponentForm方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCardForms
public function getCardForms()
{
$ret = array();
$title = Kwf_Trl::getInstance()->trlStaticExecute(Kwc_Abstract::getSetting($this->_class, 'componentName'));
$title = str_replace('.', ' ', $title);
$ret['form'] = array('form' => Kwc_Abstract_Form::createComponentForm($this->_class, 'child'), 'title' => $title);
return $ret;
}
示例2: getCardForms
public function getCardForms()
{
$ret = array();
$news = Kwf_Component_Data_Root::getInstance()->getComponentsByClass('Kwc_Events_Directory_Component');
foreach ($news as $new) {
$form = Kwc_Abstract_Form::createComponentForm($this->_class, 'child');
$form->fields['event_id']->setBaseParams(array('eventsComponentId' => $new->dbId));
$form->fields['event_id']->setFieldLabel($new->getPage()->name);
$ret[$new->dbId] = array('form' => $form, 'title' => $new->getTitle());
}
return $ret;
}
示例3: getCardForms
public function getCardForms()
{
$ret = array();
$blogs = Kwf_Component_Data_Root::getInstance()->getComponentsByClass('Kwc_Blog_Directory_Component', array('ignoreVisible' => true));
foreach ($blogs as $blog) {
$form = Kwc_Abstract_Form::createComponentForm($this->_class, 'child');
$form->fields['blog_post_id']->setBaseParams(array('blogComponentId' => $blog->dbId));
$form->fields['blog_post_id']->setFieldLabel($blog->getPage()->name);
$form->fields['blog_post_id']->setData(new Kwc_Basic_LinkTag_BlogPost_BlogPostIdData());
$ret[$blog->dbId] = array('form' => $form, 'title' => count($blogs) > 1 ? $blog->getTitle() : trlKwf('Blog'));
}
return $ret;
}
示例4: preDispatch
public function preDispatch()
{
$t = microtime(true);
if (!isset($this->_form)) {
if (isset($this->_formName)) {
$this->_form = new $this->_formName(null, $this->_getParam('class'));
} else {
$this->_form = Kwc_Abstract_Form::createComponentForm($this->_getParam('class'), 'component');
}
}
Kwf_Benchmark::subCheckpoint('create component form', microtime(true) - $t);
$this->_form->setBodyStyle('padding: 10px');
$this->_form->setId($this->_getParam('componentId'));
parent::preDispatch();
}
示例5: _createChildComponentForm
protected function _createChildComponentForm($id, $name = null)
{
if (substr($id, 0, 1) != '-' && substr($id, 0, 1) != '_') {
throw new Kwf_Exception("'-' or '_' is missing in id");
}
if (!$name) {
$name = substr($id, 1);
}
$idTemplate = '{0}' . $id;
$childComponentClass = null;
$detailClass = $this->getClass();
foreach (Kwc_Abstract::getSetting($detailClass, 'generators') as $generatorKey => $generatorData) {
$generator = Kwf_Component_Generator_Abstract::getInstance($detailClass, $generatorKey);
if ($generator->getIdSeparator() != substr($id, 0, 1)) {
continue;
}
$childComponentClass = $generator->getComponentByKey(substr($id, 1));
if ($childComponentClass) {
break;
}
}
if (!$childComponentClass) {
throw new Kwf_Exception("No child component with id '{$id}' for '{$detailClass}' found.");
}
$form = Kwc_Abstract_Form::createComponentForm($childComponentClass, $name);
if (!$form) {
return null;
}
$detailGen = Kwf_Component_Generator_Abstract::getInstance($this->getDirectoryClass(), 'detail');
if ($detailGen->hasSetting('dbIdShortcut')) {
$dbIdShortcut = $detailGen->getSetting('dbIdShortcut');
$form->setIdTemplate($dbIdShortcut . $idTemplate);
} else {
if (!$detailGen->getModel()->hasColumn('component_id')) {
throw new Kwf_Exception("Model '" . get_class($detailGen->getModel()) . "' doesn't have component_id column");
}
$form->setIdTemplate('{component_id}' . $detailGen->getIdSeparator() . $idTemplate);
}
return $form;
}