本文整理汇总了PHP中Zend_Form::getElementsBelongTo方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form::getElementsBelongTo方法的具体用法?PHP Zend_Form::getElementsBelongTo怎么用?PHP Zend_Form::getElementsBelongTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form
的用法示例。
在下文中一共展示了Zend_Form::getElementsBelongTo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _recursivelyPrepareForm
protected function _recursivelyPrepareForm(Zend_Form $form)
{
$belongsTo = $form instanceof Zend_Form ? $form->getElementsBelongTo() : null;
$elementContent = '';
$separator = $this->getSeparator();
$translator = $form->getTranslator();
$view = $form->getView();
foreach ($form as $item) {
$item->setView($view)->setTranslator($translator);
if ($item instanceof Zend_Form_Element) {
$item->setBelongsTo($belongsTo);
} elseif (!empty($belongsTo) && $item instanceof Zend_Form) {
if ($item->isArray()) {
$name = $this->mergeBelongsTo($belongsTo, $item->getElementsBelongTo());
$item->setElementsBelongTo($name, true);
} else {
$item->setElementsBelongTo($belongsTo, true);
}
$this->_recursivelyPrepareForm($item);
} elseif (!empty($belongsTo) && $item instanceof Zend_Form_DisplayGroup) {
foreach ($item as $element) {
$element->setBelongsTo($belongsTo);
}
}
}
}
示例2: __construct
public function __construct(Zend_Form $form)
{
parent::__construct();
$this->view = Zend_Layout::getMvcInstance()->getView();
$this->formName = $form->getName();
$elementsBelongTo = $form->getElementsBelongTo();
$this->elementPrefix = '';
if ($elementsBelongTo) {
$this->elementPrefix = Zmz_Utils::stripFormArrayNotation($elementsBelongTo);
$this->elementPrefix .= '-';
}
$this->init();
}
示例3: addSubForm
/**
* Add a form group/subform
*
* @param Zend_Form $form
* @param string $name
* @param int $order
* @return Zend_Form
*/
public function addSubForm(Zend_Form $form, $name, $order = null)
{
$name = (string) $name;
/** @var Zend_Loader_PluginLoader $loader */
foreach ($this->_loaders as $type => $loader) {
$loaderPaths = $loader->getPaths();
foreach ($loaderPaths as $prefix => $paths) {
foreach ($paths as $path) {
$form->addPrefixPath($prefix, $path, $type);
}
}
}
if (!empty($this->_elementPrefixPaths)) {
foreach ($this->_elementPrefixPaths as $spec) {
list($prefix, $path, $type) = array_values($spec);
$form->addElementPrefixPath($prefix, $path, $type);
}
}
if (!empty($this->_displayGroupPrefixPaths)) {
foreach ($this->_displayGroupPrefixPaths as $spec) {
list($prefix, $path) = array_values($spec);
$form->addDisplayGroupPrefixPath($prefix, $path);
}
}
if (null !== $order) {
$form->setOrder($order);
}
if (($oldName = $form->getName()) && $oldName !== $name && $oldName === $form->getElementsBelongTo()) {
$form->setElementsBelongTo($name);
}
$form->setName($name);
$this->_subForms[$name] = $form;
$this->_order[$name] = $order;
$this->_orderUpdated = true;
return $this;
}
示例4: testSettingArrayToWhichElementsBelongEmptyClearsIt
public function testSettingArrayToWhichElementsBelongEmptyClearsIt()
{
$this->testCanSetArrayToWhichElementsBelong();
$this->form->setElementsBelongTo('');
$this->assertNull($this->form->getElementsBelongTo());
}