本文整理匯總了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());
}