本文整理匯總了PHP中modResource::addMany方法的典型用法代碼示例。如果您正苦於以下問題:PHP modResource::addMany方法的具體用法?PHP modResource::addMany怎麽用?PHP modResource::addMany使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類modResource
的用法示例。
在下文中一共展示了modResource::addMany方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: beforeSet
/**
* Process the form and create the Resource
*
* {@inheritDoc}
*
* @return array|string
*/
public function beforeSet()
{
/* default settings */
$this->prepareParent();
$set = $this->checkParentPermissions();
if ($set !== true) {
return $set;
}
$this->getWorkingContext();
if (!$this->workingContext) {
return $this->modx->lexicon('access_denied');
}
$set = $this->setFieldDefaults();
if ($set !== true) {
return $set;
}
$this->preparePageTitle();
$this->prepareAlias();
$this->handleResourceProperties();
$this->object->set('template', $this->getProperty('template', 0));
$templateVariables = $this->addTemplateVariables();
if (!empty($templateVariables)) {
$this->object->addMany($templateVariables);
}
return parent::beforeSet();
}
示例2: addMany
/**
* @param mixed $obj
* @param string $alias
*
* @return bool
*/
public function addMany(&$obj, $alias = '')
{
$added = false;
if (is_array($obj)) {
foreach ($obj as $o) {
/** @var xpdoObject $o */
if (is_object($o)) {
$o->set('class', $this->class_key);
$added = parent::addMany($obj, $alias);
}
}
return $added;
} else {
return parent::addMany($obj, $alias);
}
}
示例3: addMany
/**
* {@inheritdoc}
* */
public function addMany(&$obj, $alias = '')
{
if (empty($alias)) {
if ($obj->_alias == $obj->_class) {
$aliases = $this->_getAliases($obj->_class, 1);
if (!empty($aliases)) {
$obj->_alias = reset($aliases);
}
}
$alias = $obj->_alias;
}
if (in_array($alias, $this->dataRelated)) {
if (!is_object($this->data)) {
$this->loadData();
}
return $this->data->addMany($obj, $alias);
} else {
return parent::addMany($obj, $alias);
}
}