本文整理汇总了PHP中Node::getNodePartials方法的典型用法代码示例。如果您正苦于以下问题:PHP Node::getNodePartials方法的具体用法?PHP Node::getNodePartials怎么用?PHP Node::getNodePartials使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Node
的用法示例。
在下文中一共展示了Node::getNodePartials方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadAudioTagsCms
public function loadAudioTagsCms($nothing, $nothing, Node $node)
{
if ($node->getNodePartials()->getOutPartials() != "") {
$tagDefs = $node->getNodeRef()->getElement()->Schema->getTagDefs();
foreach ($tagDefs as $k => $tagDef) {
if ($tagDef->Partial->TagAspect == 'audio') {
$node->getNodePartials()->increaseOutPartials('#' . $tagDef->Partial->TagRole . '.#original.#url');
}
}
}
}
示例2: loadMediaTagsOriginalsCms
public function loadMediaTagsOriginalsCms($nothing, $nothing, Node $node)
{
return;
if ($node->getNodePartials()->getOutPartials() != "") {
$tagDefs = $node->getNodeRef()->getElement()->Schema->getTagDefs();
foreach ($tagDefs as $k => $tagDef) {
if ($tagDef->Partial->TagAspect == 'media') {
$node->getNodePartials()->increaseOutPartials('#' . $tagDef->Partial->TagRole . '.#original.#url,#' . $tagDef->Partial->TagRole . '.#original.#height,#' . $tagDef->Partial->TagRole . '.#original.#width');
}
}
}
}
示例3: loadImageTagsThumbnailsCms
public function loadImageTagsThumbnailsCms($nothing, $nothing, Node $node)
{
return;
if ($node->getNodePartials()->getOutPartials() != "") {
$tagDefs = $node->getNodeRef()->getElement()->Schema->getTagDefs();
foreach ($tagDefs as $k => $tagDef) {
if ($tagDef->Partial->TagAspect == 'images') {
$node->getNodePartials()->increaseOutPartials('#' . $tagDef->Partial->TagRole . '.#thumbnails.#url,#' . $tagDef->Partial->TagRole . '.#thumbnails.#width,#' . $tagDef->Partial->TagRole . '.#thumbnails.#height');
}
}
}
}
示例4: requirePrimaryImage
public function requirePrimaryImage(Errors &$errors, NodeRef $nodeRef, Node &$node)
{
$element = $nodeRef->getElement();
$schema = $element->getSchema();
if (!PartialUtils::isTagRoleInOutTagsScope($schema, $node->getNodePartials(), '#primary-image')) {
// this should only occur during bulk cms actions
return;
}
if ($schema->hasTagDef('#primary-image')) {
$primaryImageTag = $node->getOutTag('#primary-image');
$errors->rejectIfEmpty('#primary-image', 'tag', 'Primary Image', $primaryImageTag);
}
}
示例5: editInternal
protected function editInternal(Node $node)
{
$existingNode = $this->NodeLookupDAO->getByNodeRef($node->getNodeRef());
$this->Logger->debug('Editing node [' . $node->getNodeRef() . '] with partials [' . $node->getNodePartials() . ']');
// update the record
$primaryKey = $this->NodeDBMeta->getPrimaryKey($node->getNodeRef());
$id = $existingNode->getID();
$node->{$primaryKey} = $id;
$node->ID = $id;
$db = $this->getConnectionForWrite($node->getNodeRef());
$oldArray = $this->NodeMapper->nodeToPersistentArray($existingNode);
$newArray = $this->NodeMapper->nodeToPersistentArray($node);
// save meta
$changedMeta = $this->NodeMetaDAO->saveMeta($db, $node->getNodeRef(), $id, $node->getNodePartials()->getMetaPartials(), $node->getMetas(), $node->getNodePartials()->getRestrictedMetaPartials());
// save the tags
$changedOut = $this->NodeTagsDAO->saveOutTags($db, $node->getNodeRef(), $id, $node->getNodePartials()->getOutPartials(), $node->getOutTags(), $node->getNodePartials()->getRestrictedOutPartials());
$changedIn = $this->NodeTagsDAO->saveInTags($db, $node->getNodeRef(), $id, $node->getNodePartials()->getInPartials(), $node->getInTags(), $node->getNodePartials()->getRestrictedInPartials());
if (array_intersect_key($oldArray, $newArray) != $newArray) {
$newArray['ModifiedDate'] = $this->DateFactory->newStorageDate();
$node->ModifiedDate = $newArray['ModifiedDate'];
$db->updateRecord($db->quoteIdentifier($this->NodeDBMeta->getTableName($node->getNodeRef())), $newArray, "{$primaryKey} = {$db->quote($id)}");
}
}
示例6: validateMetas
protected function validateMetas(Node $node, Node $obj, NodeSchema $schema, $mode)
{
$processed_metas = array();
$metas = $obj->getMetas();
// Check all metas passed against the meta defs.
foreach ($metas as $meta) {
// Ensure the meta has a meta_def
$meta_def = $schema->getMetaDef($meta->getMetaName());
$this->getErrors()->rejectIfInvalid($this->resolveField($node->getNodeRef(), $meta->getMetaName(), $obj instanceof Section ? $obj : null), 'meta', $meta_def->Title, $meta->getValue(), $meta_def->Validation);
$processed_metas[] = $meta->getMetaName();
}
$meta_defs = $schema->getMetaDefs();
// Check all meta defs that haven't been processed
// These meta defs must only match partials that we have.
$meta_partials = PartialUtils::unserializeMetaPartials($node->getNodePartials()->getMetaPartials());
$re_meta_partials = PartialUtils::unserializeMetaPartials($node->getNodePartials()->getRestrictedMetaPartials());
foreach ($meta_defs as $meta_def) {
if (in_array($meta_def->Id, $processed_metas)) {
continue;
}
if ($mode == 'edit' && !$this->metaInScope($schema, new Meta($meta_def->Id, ''), $meta_partials, $re_meta_partials)) {
continue;
}
// Validate the meta def with a null value
$this->getErrors()->rejectIfInvalid($this->resolveField($node->getNodeRef(), $meta_def->Id, $obj instanceof Section ? $obj : null), 'meta', $meta_def->Title, null, $meta_def->Validation);
$processed_metas[] = $meta_def->Id;
}
}
示例7: fireBindEvents
protected function fireBindEvents($action, Node &$node, Errors &$errors, array $fields, array $rawFields)
{
if (isset($fields['OutTags_partials'])) {
foreach (StringUtils::smartSplit($fields['OutTags_partials'], ',', '"', '\\"') as $partial) {
$node->getNodePartials()->increaseOutPartials($partial);
}
}
if (isset($fields['InTags_partials'])) {
foreach (StringUtils::smartSplit($fields['InTags_partials'], ',', '"', '\\"') as $partial) {
$node->getNodePartials()->increaseInPartials($partial);
}
}
foreach ((array) $node->getNodeRef()->getElement()->getAspects() as $aspect) {
$this->Events->trigger('Node.@' . $aspect->Slug . '.bind', $action, $node, $errors, $fields, $rawFields);
$schema = $aspect->getSchema();
foreach ($schema->getMetaDefs() as $metaDef) {
$bound = $this->Events->trigger('Node.@' . $aspect->Slug . '.meta.#' . $metaDef->Id . '.bind', $action, $node, $errors, $fields, $rawFields);
if (!$bound) {
$this->bindMeta($node, $errors, $fields, $rawFields, $metaDef->Id);
}
}
foreach ($schema->getTagDefs() as $tagDef) {
if ($tagDef->Direction == 'in') {
$bound = $this->Events->trigger('Node.@' . $aspect->Slug . '.intags.#' . $tagDef->Id . '.bind', $action, $node, $errors, $fields, $rawFields);
if (!$bound && $tagDef->isFieldlike()) {
$this->bindInTags($node, $errors, $fields, $rawFields, $tagDef->Id);
}
} else {
$bound = $this->Events->trigger('Node.@' . $aspect->Slug . '.outtags.#' . $tagDef->Id . '.bind', $action, $node, $errors, $fields, $rawFields);
if (!$bound && $tagDef->isFieldlike()) {
$this->bindOutTags($node, $errors, $fields, $rawFields, $tagDef->Id);
}
}
}
}
$errors->throwOnError();
}