repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.CMSEditLink | public function CMSEditLink()
{
$link = Controller::join_links(
CMSPageEditController::singleton()->Link('show'),
$this->ID
);
return Director::absoluteURL($link);
} | php | public function CMSEditLink()
{
$link = Controller::join_links(
CMSPageEditController::singleton()->Link('show'),
$this->ID
);
return Director::absoluteURL($link);
} | [
"public",
"function",
"CMSEditLink",
"(",
")",
"{",
"$",
"link",
"=",
"Controller",
"::",
"join_links",
"(",
"CMSPageEditController",
"::",
"singleton",
"(",
")",
"->",
"Link",
"(",
"'show'",
")",
",",
"$",
"this",
"->",
"ID",
")",
";",
"return",
"Direct... | Generates a link to edit this page in the CMS.
@return string | [
"Generates",
"a",
"link",
"to",
"edit",
"this",
"page",
"in",
"the",
"CMS",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L684-L691 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.isCurrent | public function isCurrent()
{
$currentPage = Director::get_current_page();
if ($currentPage instanceof ContentController) {
$currentPage = $currentPage->data();
}
if ($currentPage instanceof SiteTree) {
return $currentPage === $this || $currentPage->ID === $th... | php | public function isCurrent()
{
$currentPage = Director::get_current_page();
if ($currentPage instanceof ContentController) {
$currentPage = $currentPage->data();
}
if ($currentPage instanceof SiteTree) {
return $currentPage === $this || $currentPage->ID === $th... | [
"public",
"function",
"isCurrent",
"(",
")",
"{",
"$",
"currentPage",
"=",
"Director",
"::",
"get_current_page",
"(",
")",
";",
"if",
"(",
"$",
"currentPage",
"instanceof",
"ContentController",
")",
"{",
"$",
"currentPage",
"=",
"$",
"currentPage",
"->",
"da... | Returns true if this is the currently active page being used to handle this request.
@return bool | [
"Returns",
"true",
"if",
"this",
"is",
"the",
"currently",
"active",
"page",
"being",
"used",
"to",
"handle",
"this",
"request",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L709-L719 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.isSection | public function isSection()
{
return $this->isCurrent() || (
Director::get_current_page() instanceof SiteTree && in_array($this->ID, Director::get_current_page()->getAncestors()->column())
);
} | php | public function isSection()
{
return $this->isCurrent() || (
Director::get_current_page() instanceof SiteTree && in_array($this->ID, Director::get_current_page()->getAncestors()->column())
);
} | [
"public",
"function",
"isSection",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"isCurrent",
"(",
")",
"||",
"(",
"Director",
"::",
"get_current_page",
"(",
")",
"instanceof",
"SiteTree",
"&&",
"in_array",
"(",
"$",
"this",
"->",
"ID",
",",
"Director",
":... | Check if this page is in the currently active section (e.g. it is either current or one of its children is
currently being viewed).
@return bool | [
"Check",
"if",
"this",
"page",
"is",
"in",
"the",
"currently",
"active",
"section",
"(",
"e",
".",
"g",
".",
"it",
"is",
"either",
"current",
"or",
"one",
"of",
"its",
"children",
"is",
"currently",
"being",
"viewed",
")",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L727-L732 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.isOrphaned | public function isOrphaned()
{
// Always false for root pages
if (empty($this->ParentID)) {
return false;
}
// Parent must exist and not be an orphan itself
$parent = $this->Parent();
return !$parent || !$parent->exists() || $parent->isOrphaned();
} | php | public function isOrphaned()
{
// Always false for root pages
if (empty($this->ParentID)) {
return false;
}
// Parent must exist and not be an orphan itself
$parent = $this->Parent();
return !$parent || !$parent->exists() || $parent->isOrphaned();
} | [
"public",
"function",
"isOrphaned",
"(",
")",
"{",
"// Always false for root pages",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"ParentID",
")",
")",
"{",
"return",
"false",
";",
"}",
"// Parent must exist and not be an orphan itself",
"$",
"parent",
"=",
"$",
... | Check if the parent of this page has been removed (or made otherwise unavailable), and is still referenced by
this child. Any such orphaned page may still require access via the CMS, but should not be shown as accessible
to external users.
@return bool | [
"Check",
"if",
"the",
"parent",
"of",
"this",
"page",
"has",
"been",
"removed",
"(",
"or",
"made",
"otherwise",
"unavailable",
")",
"and",
"is",
"still",
"referenced",
"by",
"this",
"child",
".",
"Any",
"such",
"orphaned",
"page",
"may",
"still",
"require"... | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L741-L751 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.duplicateWithChildren | public function duplicateWithChildren()
{
/** @var SiteTree $clone */
$clone = $this->duplicate();
$children = $this->AllChildren();
if ($children) {
/** @var SiteTree $child */
$sort = 0;
foreach ($children as $child) {
$childClon... | php | public function duplicateWithChildren()
{
/** @var SiteTree $clone */
$clone = $this->duplicate();
$children = $this->AllChildren();
if ($children) {
/** @var SiteTree $child */
$sort = 0;
foreach ($children as $child) {
$childClon... | [
"public",
"function",
"duplicateWithChildren",
"(",
")",
"{",
"/** @var SiteTree $clone */",
"$",
"clone",
"=",
"$",
"this",
"->",
"duplicate",
"(",
")",
";",
"$",
"children",
"=",
"$",
"this",
"->",
"AllChildren",
"(",
")",
";",
"if",
"(",
"$",
"children"... | Duplicates each child of this node recursively and returns the top-level duplicate node.
@return static The duplicated object | [
"Duplicates",
"each",
"child",
"of",
"this",
"node",
"recursively",
"and",
"returns",
"the",
"top",
"-",
"level",
"duplicate",
"node",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L824-L845 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.duplicateAsChild | public function duplicateAsChild($id)
{
/** @var SiteTree $newSiteTree */
$newSiteTree = $this->duplicate();
$newSiteTree->ParentID = $id;
$newSiteTree->Sort = 0;
$newSiteTree->write();
} | php | public function duplicateAsChild($id)
{
/** @var SiteTree $newSiteTree */
$newSiteTree = $this->duplicate();
$newSiteTree->ParentID = $id;
$newSiteTree->Sort = 0;
$newSiteTree->write();
} | [
"public",
"function",
"duplicateAsChild",
"(",
"$",
"id",
")",
"{",
"/** @var SiteTree $newSiteTree */",
"$",
"newSiteTree",
"=",
"$",
"this",
"->",
"duplicate",
"(",
")",
";",
"$",
"newSiteTree",
"->",
"ParentID",
"=",
"$",
"id",
";",
"$",
"newSiteTree",
"-... | Duplicate this node and its children as a child of the node with the given ID
@param int $id ID of the new node's new parent | [
"Duplicate",
"this",
"node",
"and",
"its",
"children",
"as",
"a",
"child",
"of",
"the",
"node",
"with",
"the",
"given",
"ID"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L852-L859 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.getBreadcrumbItems | public function getBreadcrumbItems($maxDepth = 20, $stopAtPageType = false, $showHidden = false)
{
$page = $this;
$pages = array();
while ($page
&& $page->exists()
&& (!$maxDepth || count($pages) < $maxDepth)
&& (!$stopAtPageType || $page->ClassName != $s... | php | public function getBreadcrumbItems($maxDepth = 20, $stopAtPageType = false, $showHidden = false)
{
$page = $this;
$pages = array();
while ($page
&& $page->exists()
&& (!$maxDepth || count($pages) < $maxDepth)
&& (!$stopAtPageType || $page->ClassName != $s... | [
"public",
"function",
"getBreadcrumbItems",
"(",
"$",
"maxDepth",
"=",
"20",
",",
"$",
"stopAtPageType",
"=",
"false",
",",
"$",
"showHidden",
"=",
"false",
")",
"{",
"$",
"page",
"=",
"$",
"this",
";",
"$",
"pages",
"=",
"array",
"(",
")",
";",
"whi... | Returns a list of breadcrumbs for the current page.
@param int $maxDepth The maximum depth to traverse.
@param boolean|string $stopAtPageType ClassName of a page to stop the upwards traversal.
@param boolean $showHidden Include pages marked with the attribute ShowInMenus = 0
@return ArrayList | [
"Returns",
"a",
"list",
"of",
"breadcrumbs",
"for",
"the",
"current",
"page",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L892-L910 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.setParent | public function setParent($item)
{
if (is_object($item)) {
if (!$item->exists()) {
$item->write();
}
$this->setField("ParentID", $item->ID);
} else {
$this->setField("ParentID", $item);
}
} | php | public function setParent($item)
{
if (is_object($item)) {
if (!$item->exists()) {
$item->write();
}
$this->setField("ParentID", $item->ID);
} else {
$this->setField("ParentID", $item);
}
} | [
"public",
"function",
"setParent",
"(",
"$",
"item",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"item",
")",
")",
"{",
"if",
"(",
"!",
"$",
"item",
"->",
"exists",
"(",
")",
")",
"{",
"$",
"item",
"->",
"write",
"(",
")",
";",
"}",
"$",
"thi... | Make this page a child of another page.
If the parent page does not exist, resolve it to a valid ID before updating this page's reference.
@param SiteTree|int $item Either the parent object, or the parent ID | [
"Make",
"this",
"page",
"a",
"child",
"of",
"another",
"page",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L920-L930 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.getParent | public function getParent()
{
$parentID = $this->getField("ParentID");
if ($parentID) {
return SiteTree::get_by_id(self::class, $parentID);
}
return null;
} | php | public function getParent()
{
$parentID = $this->getField("ParentID");
if ($parentID) {
return SiteTree::get_by_id(self::class, $parentID);
}
return null;
} | [
"public",
"function",
"getParent",
"(",
")",
"{",
"$",
"parentID",
"=",
"$",
"this",
"->",
"getField",
"(",
"\"ParentID\"",
")",
";",
"if",
"(",
"$",
"parentID",
")",
"{",
"return",
"SiteTree",
"::",
"get_by_id",
"(",
"self",
"::",
"class",
",",
"$",
... | Get the parent of this page.
@return SiteTree Parent of this page | [
"Get",
"the",
"parent",
"of",
"this",
"page",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L937-L944 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.NestedTitle | public function NestedTitle($level = 2, $separator = " - ")
{
$item = $this;
$parts = [];
while ($item && $level > 0) {
$parts[] = $item->Title;
$item = $item->getParent();
$level--;
}
return implode($separator, array_reverse($parts));
... | php | public function NestedTitle($level = 2, $separator = " - ")
{
$item = $this;
$parts = [];
while ($item && $level > 0) {
$parts[] = $item->Title;
$item = $item->getParent();
$level--;
}
return implode($separator, array_reverse($parts));
... | [
"public",
"function",
"NestedTitle",
"(",
"$",
"level",
"=",
"2",
",",
"$",
"separator",
"=",
"\" - \"",
")",
"{",
"$",
"item",
"=",
"$",
"this",
";",
"$",
"parts",
"=",
"[",
"]",
";",
"while",
"(",
"$",
"item",
"&&",
"$",
"level",
">",
"0",
")... | Return a string of the form "parent - page" or "grandparent - parent - page" using page titles
@param int $level The maximum amount of levels to traverse.
@param string $separator Seperating string
@return string The resulting string | [
"Return",
"a",
"string",
"of",
"the",
"form",
"parent",
"-",
"page",
"or",
"grandparent",
"-",
"parent",
"-",
"page",
"using",
"page",
"titles"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L972-L982 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.can | public function can($perm, $member = null, $context = array())
{
if (!$member) {
$member = Security::getCurrentUser();
}
if ($member && Permission::checkMember($member, "ADMIN")) {
return true;
}
if (is_string($perm) && method_exists($this, 'can' . u... | php | public function can($perm, $member = null, $context = array())
{
if (!$member) {
$member = Security::getCurrentUser();
}
if ($member && Permission::checkMember($member, "ADMIN")) {
return true;
}
if (is_string($perm) && method_exists($this, 'can' . u... | [
"public",
"function",
"can",
"(",
"$",
"perm",
",",
"$",
"member",
"=",
"null",
",",
"$",
"context",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"$",
"member",
")",
"{",
"$",
"member",
"=",
"Security",
"::",
"getCurrentUser",
"(",
")",
";",... | This function should return true if the current user can execute this action. It can be overloaded to customise
the security model for an application.
Slightly altered from parent behaviour in {@link DataObject->can()}:
- Checks for existence of a method named "can<$perm>()" on the object
- Calls decorators and only r... | [
"This",
"function",
"should",
"return",
"true",
"if",
"the",
"current",
"user",
"can",
"execute",
"this",
"action",
".",
"It",
"can",
"be",
"overloaded",
"to",
"customise",
"the",
"security",
"model",
"for",
"an",
"application",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L1001-L1024 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.canAddChildren | public function canAddChildren($member = null)
{
// Disable adding children to archived pages
if (!$this->isOnDraft()) {
return false;
}
if (!$member) {
$member = Security::getCurrentUser();
}
// Standard mechanism for accepting permission ch... | php | public function canAddChildren($member = null)
{
// Disable adding children to archived pages
if (!$this->isOnDraft()) {
return false;
}
if (!$member) {
$member = Security::getCurrentUser();
}
// Standard mechanism for accepting permission ch... | [
"public",
"function",
"canAddChildren",
"(",
"$",
"member",
"=",
"null",
")",
"{",
"// Disable adding children to archived pages",
"if",
"(",
"!",
"$",
"this",
"->",
"isOnDraft",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"$",
"member... | This function should return true if the current user can add children to this page. It can be overloaded to
customise the security model for an application.
Denies permission if any of the following conditions is true:
- alternateCanAddChildren() on a extension returns false
- canEdit() is not granted
- There are no c... | [
"This",
"function",
"should",
"return",
"true",
"if",
"the",
"current",
"user",
"can",
"add",
"children",
"to",
"this",
"page",
".",
"It",
"can",
"be",
"overloaded",
"to",
"customise",
"the",
"security",
"model",
"for",
"an",
"application",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L1042-L1065 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.canView | public function canView($member = null)
{
if (!$member) {
$member = Security::getCurrentUser();
}
// Standard mechanism for accepting permission changes from extensions
$extended = $this->extendedCan('canView', $member);
if ($extended !== null) {
retu... | php | public function canView($member = null)
{
if (!$member) {
$member = Security::getCurrentUser();
}
// Standard mechanism for accepting permission changes from extensions
$extended = $this->extendedCan('canView', $member);
if ($extended !== null) {
retu... | [
"public",
"function",
"canView",
"(",
"$",
"member",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"member",
")",
"{",
"$",
"member",
"=",
"Security",
"::",
"getCurrentUser",
"(",
")",
";",
"}",
"// Standard mechanism for accepting permission changes from extensio... | This function should return true if the current user can view this page. It can be overloaded to customise the
security model for an application.
Denies permission if any of the following conditions is true:
- canView() on any extension returns false
- "CanViewType" directive is set to "Inherit" and any parent page re... | [
"This",
"function",
"should",
"return",
"true",
"if",
"the",
"current",
"user",
"can",
"view",
"this",
"page",
".",
"It",
"can",
"be",
"overloaded",
"to",
"customise",
"the",
"security",
"model",
"for",
"an",
"application",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L1083-L1136 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.canCreate | public function canCreate($member = null, $context = array())
{
if (!$member) {
$member = Security::getCurrentUser();
}
// Check parent (custom canCreate option for SiteTree)
// Block children not allowed for this parent type
$parent = isset($context['Parent']) ?... | php | public function canCreate($member = null, $context = array())
{
if (!$member) {
$member = Security::getCurrentUser();
}
// Check parent (custom canCreate option for SiteTree)
// Block children not allowed for this parent type
$parent = isset($context['Parent']) ?... | [
"public",
"function",
"canCreate",
"(",
"$",
"member",
"=",
"null",
",",
"$",
"context",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"$",
"member",
")",
"{",
"$",
"member",
"=",
"Security",
"::",
"getCurrentUser",
"(",
")",
";",
"}",
"// Chec... | This function should return true if the current user can create new pages of this class, regardless of class. It
can be overloaded to customise the security model for an application.
By default, permission to create at the root level is based on the SiteConfig configuration, and permission to
create beneath a parent i... | [
"This",
"function",
"should",
"return",
"true",
"if",
"the",
"current",
"user",
"can",
"create",
"new",
"pages",
"of",
"this",
"class",
"regardless",
"of",
"class",
".",
"It",
"can",
"be",
"overloaded",
"to",
"customise",
"the",
"security",
"model",
"for",
... | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L1224-L1257 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.getSiteConfig | public function getSiteConfig()
{
$configs = $this->invokeWithExtensions('alternateSiteConfig');
foreach (array_filter($configs) as $config) {
return $config;
}
return SiteConfig::current_site_config();
} | php | public function getSiteConfig()
{
$configs = $this->invokeWithExtensions('alternateSiteConfig');
foreach (array_filter($configs) as $config) {
return $config;
}
return SiteConfig::current_site_config();
} | [
"public",
"function",
"getSiteConfig",
"(",
")",
"{",
"$",
"configs",
"=",
"$",
"this",
"->",
"invokeWithExtensions",
"(",
"'alternateSiteConfig'",
")",
";",
"foreach",
"(",
"array_filter",
"(",
"$",
"configs",
")",
"as",
"$",
"config",
")",
"{",
"return",
... | Stub method to get the site config, unless the current class can provide an alternate.
@return SiteConfig | [
"Stub",
"method",
"to",
"get",
"the",
"site",
"config",
"unless",
"the",
"current",
"class",
"can",
"provide",
"an",
"alternate",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L1306-L1314 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.collateDescendants | public function collateDescendants($condition, &$collator)
{
// apply reasonable hierarchy limits
$threshold = Config::inst()->get(Hierarchy::class, 'node_threshold_leaf');
if ($this->numChildren() > $threshold) {
return false;
}
$children = $this->Children();
... | php | public function collateDescendants($condition, &$collator)
{
// apply reasonable hierarchy limits
$threshold = Config::inst()->get(Hierarchy::class, 'node_threshold_leaf');
if ($this->numChildren() > $threshold) {
return false;
}
$children = $this->Children();
... | [
"public",
"function",
"collateDescendants",
"(",
"$",
"condition",
",",
"&",
"$",
"collator",
")",
"{",
"// apply reasonable hierarchy limits",
"$",
"threshold",
"=",
"Config",
"::",
"inst",
"(",
")",
"->",
"get",
"(",
"Hierarchy",
"::",
"class",
",",
"'node_t... | Collate selected descendants of this page.
{@link $condition} will be evaluated on each descendant, and if it is succeeds, that item will be added to the
$collator array.
@param string $condition The PHP condition to be evaluated. The page will be called $item
@param array $collator An array, passed by reference, t... | [
"Collate",
"selected",
"descendants",
"of",
"this",
"page",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L1334-L1354 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.MetaComponents | public function MetaComponents()
{
$tags = [];
$tags['title'] = [
'tag' => 'title',
'content' => $this->obj('Title')->forTemplate()
];
$generator = trim(Config::inst()->get(self::class, 'meta_generator'));
if (!empty($generator)) {
$tags[... | php | public function MetaComponents()
{
$tags = [];
$tags['title'] = [
'tag' => 'title',
'content' => $this->obj('Title')->forTemplate()
];
$generator = trim(Config::inst()->get(self::class, 'meta_generator'));
if (!empty($generator)) {
$tags[... | [
"public",
"function",
"MetaComponents",
"(",
")",
"{",
"$",
"tags",
"=",
"[",
"]",
";",
"$",
"tags",
"[",
"'title'",
"]",
"=",
"[",
"'tag'",
"=>",
"'title'",
",",
"'content'",
"=>",
"$",
"this",
"->",
"obj",
"(",
"'Title'",
")",
"->",
"forTemplate",
... | Return attributes for various meta tags, plus a title tag, in a keyed array.
Array structure corresponds to arguments for HTML::create_tag(). Example:
$tags['description'] = [
// html tag type, if omitted defaults to 'meta'
'tag' => 'meta',
// attributes of html tag
'attributes' => [
'name' => 'description',
'content'... | [
"Return",
"attributes",
"for",
"various",
"meta",
"tags",
"plus",
"a",
"title",
"tag",
"in",
"a",
"keyed",
"array",
".",
"Array",
"structure",
"corresponds",
"to",
"arguments",
"for",
"HTML",
"::",
"create_tag",
"()",
".",
"Example",
":"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L1375-L1430 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.MetaTags | public function MetaTags($includeTitle = true)
{
$tags = [];
$tagsArray = $this->MetaComponents();
if (!$includeTitle || strtolower($includeTitle) == 'false') {
unset($tagsArray['title']);
}
foreach ($tagsArray as $tagProps) {
$tag = array_merge([
... | php | public function MetaTags($includeTitle = true)
{
$tags = [];
$tagsArray = $this->MetaComponents();
if (!$includeTitle || strtolower($includeTitle) == 'false') {
unset($tagsArray['title']);
}
foreach ($tagsArray as $tagProps) {
$tag = array_merge([
... | [
"public",
"function",
"MetaTags",
"(",
"$",
"includeTitle",
"=",
"true",
")",
"{",
"$",
"tags",
"=",
"[",
"]",
";",
"$",
"tagsArray",
"=",
"$",
"this",
"->",
"MetaComponents",
"(",
")",
";",
"if",
"(",
"!",
"$",
"includeTitle",
"||",
"strtolower",
"(... | Return the title, description, keywords and language metatags.
@param bool $includeTitle Show default <title>-tag, set to false for custom templating
@return string The XHTML metatags | [
"Return",
"the",
"title",
"description",
"keywords",
"and",
"language",
"metatags",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L1438-L1463 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.requireDefaultRecords | public function requireDefaultRecords()
{
parent::requireDefaultRecords();
// default pages
if (static::class === self::class && $this->config()->get('create_default_pages')) {
$defaultHomepage = RootURLController::config()->get('default_homepage_link');
if (!SiteTre... | php | public function requireDefaultRecords()
{
parent::requireDefaultRecords();
// default pages
if (static::class === self::class && $this->config()->get('create_default_pages')) {
$defaultHomepage = RootURLController::config()->get('default_homepage_link');
if (!SiteTre... | [
"public",
"function",
"requireDefaultRecords",
"(",
")",
"{",
"parent",
"::",
"requireDefaultRecords",
"(",
")",
";",
"// default pages",
"if",
"(",
"static",
"::",
"class",
"===",
"self",
"::",
"class",
"&&",
"$",
"this",
"->",
"config",
"(",
")",
"->",
"... | Add default records to database.
This function is called whenever the database is built, after the database tables have all been created. Overload
this to add default records when the database is built, but make sure you call parent::requireDefaultRecords(). | [
"Add",
"default",
"records",
"to",
"database",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L1484-L1529 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.flushMemberCache | public function flushMemberCache($memberIDs = null)
{
$cache = SiteTree::singleton()->getCreatableChildrenCache();
if (!$memberIDs) {
$cache->clear();
return;
}
foreach ($memberIDs as $memberID) {
$key = $this->generateChildrenCacheKey($memberID)... | php | public function flushMemberCache($memberIDs = null)
{
$cache = SiteTree::singleton()->getCreatableChildrenCache();
if (!$memberIDs) {
$cache->clear();
return;
}
foreach ($memberIDs as $memberID) {
$key = $this->generateChildrenCacheKey($memberID)... | [
"public",
"function",
"flushMemberCache",
"(",
"$",
"memberIDs",
"=",
"null",
")",
"{",
"$",
"cache",
"=",
"SiteTree",
"::",
"singleton",
"(",
")",
"->",
"getCreatableChildrenCache",
"(",
")",
";",
"if",
"(",
"!",
"$",
"memberIDs",
")",
"{",
"$",
"cache"... | Flushes the member specific cache for creatable children
@param array $memberIDs | [
"Flushes",
"the",
"member",
"specific",
"cache",
"for",
"creatable",
"children"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L1632-L1645 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.validURLSegment | public function validURLSegment()
{
// Check known urlsegment blacklists
if (self::config()->get('nested_urls') && $this->ParentID) {
// Guard against url segments for sub-pages
$parent = $this->Parent();
if ($controller = ModelAsController::controller_for($parent... | php | public function validURLSegment()
{
// Check known urlsegment blacklists
if (self::config()->get('nested_urls') && $this->ParentID) {
// Guard against url segments for sub-pages
$parent = $this->Parent();
if ($controller = ModelAsController::controller_for($parent... | [
"public",
"function",
"validURLSegment",
"(",
")",
"{",
"// Check known urlsegment blacklists",
"if",
"(",
"self",
"::",
"config",
"(",
")",
"->",
"get",
"(",
"'nested_urls'",
")",
"&&",
"$",
"this",
"->",
"ParentID",
")",
"{",
"// Guard against url segments for s... | Returns true if this object has a URLSegment value that does not conflict with any other objects. This method
checks for:
- A page with the same URLSegment that has a conflict
- Conflicts with actions on the parent page
- A conflict caused by a root page having the same URLSegment as a class name
@return bool | [
"Returns",
"true",
"if",
"this",
"object",
"has",
"a",
"URLSegment",
"value",
"that",
"does",
"not",
"conflict",
"with",
"any",
"other",
"objects",
".",
"This",
"method",
"checks",
"for",
":",
"-",
"A",
"page",
"with",
"the",
"same",
"URLSegment",
"that",
... | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L1698-L1735 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.generateURLSegment | public function generateURLSegment($title)
{
$filter = URLSegmentFilter::create();
$filteredTitle = $filter->filter($title);
// Fallback to generic page name if path is empty (= no valid, convertable characters)
if (!$filteredTitle || $filteredTitle == '-' || $filteredTitle == '-1')... | php | public function generateURLSegment($title)
{
$filter = URLSegmentFilter::create();
$filteredTitle = $filter->filter($title);
// Fallback to generic page name if path is empty (= no valid, convertable characters)
if (!$filteredTitle || $filteredTitle == '-' || $filteredTitle == '-1')... | [
"public",
"function",
"generateURLSegment",
"(",
"$",
"title",
")",
"{",
"$",
"filter",
"=",
"URLSegmentFilter",
"::",
"create",
"(",
")",
";",
"$",
"filteredTitle",
"=",
"$",
"filter",
"->",
"filter",
"(",
"$",
"title",
")",
";",
"// Fallback to generic pag... | Generate a URL segment based on the title provided.
If {@link Extension}s wish to alter URL segment generation, they can do so by defining
updateURLSegment(&$url, $title). $url will be passed by reference and should be modified. $title will contain
the title that was originally used as the source of this generated UR... | [
"Generate",
"a",
"URL",
"segment",
"based",
"on",
"the",
"title",
"provided",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L1748-L1762 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.getStageURLSegment | public function getStageURLSegment()
{
/** @var SiteTree $stageRecord */
$stageRecord = Versioned::get_one_by_stage(self::class, Versioned::DRAFT, [
'"SiteTree"."ID"' => $this->ID
]);
return ($stageRecord) ? $stageRecord->URLSegment : null;
} | php | public function getStageURLSegment()
{
/** @var SiteTree $stageRecord */
$stageRecord = Versioned::get_one_by_stage(self::class, Versioned::DRAFT, [
'"SiteTree"."ID"' => $this->ID
]);
return ($stageRecord) ? $stageRecord->URLSegment : null;
} | [
"public",
"function",
"getStageURLSegment",
"(",
")",
"{",
"/** @var SiteTree $stageRecord */",
"$",
"stageRecord",
"=",
"Versioned",
"::",
"get_one_by_stage",
"(",
"self",
"::",
"class",
",",
"Versioned",
"::",
"DRAFT",
",",
"[",
"'\"SiteTree\".\"ID\"'",
"=>",
"$",... | Gets the URL segment for the latest draft version of this page.
@return string | [
"Gets",
"the",
"URL",
"segment",
"for",
"the",
"latest",
"draft",
"version",
"of",
"this",
"page",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L1769-L1776 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.getLiveURLSegment | public function getLiveURLSegment()
{
/** @var SiteTree $liveRecord */
$liveRecord = Versioned::get_one_by_stage(self::class, Versioned::LIVE, [
'"SiteTree"."ID"' => $this->ID
]);
return ($liveRecord) ? $liveRecord->URLSegment : null;
} | php | public function getLiveURLSegment()
{
/** @var SiteTree $liveRecord */
$liveRecord = Versioned::get_one_by_stage(self::class, Versioned::LIVE, [
'"SiteTree"."ID"' => $this->ID
]);
return ($liveRecord) ? $liveRecord->URLSegment : null;
} | [
"public",
"function",
"getLiveURLSegment",
"(",
")",
"{",
"/** @var SiteTree $liveRecord */",
"$",
"liveRecord",
"=",
"Versioned",
"::",
"get_one_by_stage",
"(",
"self",
"::",
"class",
",",
"Versioned",
"::",
"LIVE",
",",
"[",
"'\"SiteTree\".\"ID\"'",
"=>",
"$",
"... | Gets the URL segment for the currently published version of this page.
@return string | [
"Gets",
"the",
"URL",
"segment",
"for",
"the",
"currently",
"published",
"version",
"of",
"this",
"page",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L1783-L1790 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.BackLinkTracking | public function BackLinkTracking()
{
// @todo - Implement PolymorphicManyManyList to replace this
$list = ArrayList::create();
$siteTreelinkTable = SiteTreeLink::singleton()->baseTable();
// Get the list of back links classes
$parentClasses = $this->BackLinks()->exclude(['P... | php | public function BackLinkTracking()
{
// @todo - Implement PolymorphicManyManyList to replace this
$list = ArrayList::create();
$siteTreelinkTable = SiteTreeLink::singleton()->baseTable();
// Get the list of back links classes
$parentClasses = $this->BackLinks()->exclude(['P... | [
"public",
"function",
"BackLinkTracking",
"(",
")",
"{",
"// @todo - Implement PolymorphicManyManyList to replace this",
"$",
"list",
"=",
"ArrayList",
"::",
"create",
"(",
")",
";",
"$",
"siteTreelinkTable",
"=",
"SiteTreeLink",
"::",
"singleton",
"(",
")",
"->",
"... | Get the back-link tracking objects that link to this page
@return ArrayList|DataObject[] | [
"Get",
"the",
"back",
"-",
"link",
"tracking",
"objects",
"that",
"link",
"to",
"this",
"page"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L1797-L1831 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.DependentPages | public function DependentPages($includeVirtuals = true)
{
if (class_exists(Subsite::class)) {
$origDisableSubsiteFilter = Subsite::$disable_subsite_filter;
Subsite::disable_subsite_filter(true);
}
// Content links
$items = ArrayList::create();
// If ... | php | public function DependentPages($includeVirtuals = true)
{
if (class_exists(Subsite::class)) {
$origDisableSubsiteFilter = Subsite::$disable_subsite_filter;
Subsite::disable_subsite_filter(true);
}
// Content links
$items = ArrayList::create();
// If ... | [
"public",
"function",
"DependentPages",
"(",
"$",
"includeVirtuals",
"=",
"true",
")",
"{",
"if",
"(",
"class_exists",
"(",
"Subsite",
"::",
"class",
")",
")",
"{",
"$",
"origDisableSubsiteFilter",
"=",
"Subsite",
"::",
"$",
"disable_subsite_filter",
";",
"Sub... | Returns the pages that depend on this page. This includes virtual pages, pages that link to it, etc.
@param bool $includeVirtuals Set to false to exlcude virtual pages.
@return ArrayList|SiteTree[] | [
"Returns",
"the",
"pages",
"that",
"depend",
"on",
"this",
"page",
".",
"This",
"includes",
"virtual",
"pages",
"pages",
"that",
"link",
"to",
"it",
"etc",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L1839-L1882 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.VirtualPages | public function VirtualPages()
{
$pages = parent::VirtualPages();
// Disable subsite filter for these pages
if ($pages instanceof DataList) {
return $pages->setDataQueryParam('Subsite.filter', false);
}
return $pages;
} | php | public function VirtualPages()
{
$pages = parent::VirtualPages();
// Disable subsite filter for these pages
if ($pages instanceof DataList) {
return $pages->setDataQueryParam('Subsite.filter', false);
}
return $pages;
} | [
"public",
"function",
"VirtualPages",
"(",
")",
"{",
"$",
"pages",
"=",
"parent",
"::",
"VirtualPages",
"(",
")",
";",
"// Disable subsite filter for these pages",
"if",
"(",
"$",
"pages",
"instanceof",
"DataList",
")",
"{",
"return",
"$",
"pages",
"->",
"setD... | Return all virtual pages that link to this page.
@return DataList | [
"Return",
"all",
"virtual",
"pages",
"that",
"link",
"to",
"this",
"page",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L1889-L1898 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.getCMSFields | public function getCMSFields()
{
// Status / message
// Create a status message for multiple parents
if ($this->ID && is_numeric($this->ID)) {
$linkedPages = $this->VirtualPages();
$parentPageLinks = array();
if ($linkedPages->count() > 0) {
... | php | public function getCMSFields()
{
// Status / message
// Create a status message for multiple parents
if ($this->ID && is_numeric($this->ID)) {
$linkedPages = $this->VirtualPages();
$parentPageLinks = array();
if ($linkedPages->count() > 0) {
... | [
"public",
"function",
"getCMSFields",
"(",
")",
"{",
"// Status / message",
"// Create a status message for multiple parents",
"if",
"(",
"$",
"this",
"->",
"ID",
"&&",
"is_numeric",
"(",
"$",
"this",
"->",
"ID",
")",
")",
"{",
"$",
"linkedPages",
"=",
"$",
"t... | Returns a FieldList with which to create the main editing form.
You can override this in your child classes to add extra fields - first get the parent fields using
parent::getCMSFields(), then use addFieldToTab() on the FieldList.
See {@link getSettingsFields()} for a different set of fields concerned with configurat... | [
"Returns",
"a",
"FieldList",
"with",
"which",
"to",
"create",
"the",
"main",
"editing",
"form",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L1911-L2095 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.getSettingsFields | public function getSettingsFields()
{
$mapFn = function ($groups = []) {
$map = [];
foreach ($groups as $group) {
// Listboxfield values are escaped, use ASCII char instead of »
$map[$group->ID] = $group->getBreadcrumbs(' > ');
}
... | php | public function getSettingsFields()
{
$mapFn = function ($groups = []) {
$map = [];
foreach ($groups as $group) {
// Listboxfield values are escaped, use ASCII char instead of »
$map[$group->ID] = $group->getBreadcrumbs(' > ');
}
... | [
"public",
"function",
"getSettingsFields",
"(",
")",
"{",
"$",
"mapFn",
"=",
"function",
"(",
"$",
"groups",
"=",
"[",
"]",
")",
"{",
"$",
"map",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"groups",
"as",
"$",
"group",
")",
"{",
"// Listboxfield values... | Returns fields related to configuration aspects on this record, e.g. access control. See {@link getCMSFields()}
for content-related fields.
@return FieldList | [
"Returns",
"fields",
"related",
"to",
"configuration",
"aspects",
"on",
"this",
"record",
"e",
".",
"g",
".",
"access",
"control",
".",
"See",
"{",
"@link",
"getCMSFields",
"()",
"}",
"for",
"content",
"-",
"related",
"fields",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L2104-L2241 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.getCMSActions | public function getCMSActions()
{
// Get status of page
$isOnDraft = $this->isOnDraft();
$isPublished = $this->isPublished();
$stagesDiffer = $this->stagesDiffer();
// Check permissions
$canPublish = $this->canPublish();
$canUnpublish = $this->canUnpublish();... | php | public function getCMSActions()
{
// Get status of page
$isOnDraft = $this->isOnDraft();
$isPublished = $this->isPublished();
$stagesDiffer = $this->stagesDiffer();
// Check permissions
$canPublish = $this->canPublish();
$canUnpublish = $this->canUnpublish();... | [
"public",
"function",
"getCMSActions",
"(",
")",
"{",
"// Get status of page",
"$",
"isOnDraft",
"=",
"$",
"this",
"->",
"isOnDraft",
"(",
")",
";",
"$",
"isPublished",
"=",
"$",
"this",
"->",
"isPublished",
"(",
")",
";",
"$",
"stagesDiffer",
"=",
"$",
... | Get the actions available in the CMS for this page - eg Save, Publish.
Frontend scripts and styles know how to handle the following FormFields:
- top-level FormActions appear as standalone buttons
- top-level CompositeField with FormActions within appear as grouped buttons
- TabSet & Tabs appear as a drop ups
- FormAc... | [
"Get",
"the",
"actions",
"available",
"in",
"the",
"CMS",
"for",
"this",
"page",
"-",
"eg",
"Save",
"Publish",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L2299-L2457 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.onAfterRevertToLive | public function onAfterRevertToLive()
{
// Use an alias to get the updates made by $this->publish
/** @var SiteTree $stageSelf */
$stageSelf = Versioned::get_by_stage(self::class, Versioned::DRAFT)->byID($this->ID);
$stageSelf->writeWithoutVersion();
// Need to update pages ... | php | public function onAfterRevertToLive()
{
// Use an alias to get the updates made by $this->publish
/** @var SiteTree $stageSelf */
$stageSelf = Versioned::get_by_stage(self::class, Versioned::DRAFT)->byID($this->ID);
$stageSelf->writeWithoutVersion();
// Need to update pages ... | [
"public",
"function",
"onAfterRevertToLive",
"(",
")",
"{",
"// Use an alias to get the updates made by $this->publish",
"/** @var SiteTree $stageSelf */",
"$",
"stageSelf",
"=",
"Versioned",
"::",
"get_by_stage",
"(",
"self",
"::",
"class",
",",
"Versioned",
"::",
"DRAFT",... | Update draft dependant pages | [
"Update",
"draft",
"dependant",
"pages"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L2473-L2485 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.isParentArchived | protected function isParentArchived()
{
if ($parentID = $this->ParentID) {
/** @var SiteTree $parentPage */
$parentPage = Versioned::get_latest_version(self::class, $parentID);
if (!$parentPage || !$parentPage->isOnDraft()) {
return true;
}
... | php | protected function isParentArchived()
{
if ($parentID = $this->ParentID) {
/** @var SiteTree $parentPage */
$parentPage = Versioned::get_latest_version(self::class, $parentID);
if (!$parentPage || !$parentPage->isOnDraft()) {
return true;
}
... | [
"protected",
"function",
"isParentArchived",
"(",
")",
"{",
"if",
"(",
"$",
"parentID",
"=",
"$",
"this",
"->",
"ParentID",
")",
"{",
"/** @var SiteTree $parentPage */",
"$",
"parentPage",
"=",
"Versioned",
"::",
"get_latest_version",
"(",
"self",
"::",
"class",... | Determine if this page references a parent which is archived, and not available in stage
@return bool True if there is an archived parent | [
"Determine",
"if",
"this",
"page",
"references",
"a",
"parent",
"which",
"is",
"archived",
"and",
"not",
"available",
"in",
"stage"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L2492-L2502 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.doRestoreToStage | public function doRestoreToStage()
{
$this->invokeWithExtensions('onBeforeRestoreToStage', $this);
// Ensure that the parent page is restored, otherwise restore to root
if ($this->isParentArchived()) {
$this->ParentID = 0;
}
// Restore
$this->writeToStag... | php | public function doRestoreToStage()
{
$this->invokeWithExtensions('onBeforeRestoreToStage', $this);
// Ensure that the parent page is restored, otherwise restore to root
if ($this->isParentArchived()) {
$this->ParentID = 0;
}
// Restore
$this->writeToStag... | [
"public",
"function",
"doRestoreToStage",
"(",
")",
"{",
"$",
"this",
"->",
"invokeWithExtensions",
"(",
"'onBeforeRestoreToStage'",
",",
"$",
"this",
")",
";",
"// Ensure that the parent page is restored, otherwise restore to root",
"if",
"(",
"$",
"this",
"->",
"isPar... | Restore the content in the active copy of this SiteTree page to the stage site.
@return static | [
"Restore",
"the",
"content",
"in",
"the",
"active",
"copy",
"of",
"this",
"SiteTree",
"page",
"to",
"the",
"stage",
"site",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L2509-L2530 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.isNew | public function isNew()
{
/**
* This check was a problem for a self-hosted site, and may indicate a bug in the interpreter on their server,
* or a bug here. Changing the condition from empty($this->ID) to !$this->ID && !$this->record['ID'] fixed this.
*/
if (empty($this->I... | php | public function isNew()
{
/**
* This check was a problem for a self-hosted site, and may indicate a bug in the interpreter on their server,
* or a bug here. Changing the condition from empty($this->ID) to !$this->ID && !$this->record['ID'] fixed this.
*/
if (empty($this->I... | [
"public",
"function",
"isNew",
"(",
")",
"{",
"/**\n * This check was a problem for a self-hosted site, and may indicate a bug in the interpreter on their server,\n * or a bug here. Changing the condition from empty($this->ID) to !$this->ID && !$this->record['ID'] fixed this.\n *... | Check if this page is new - that is, if it has yet to have been written to the database.
@return bool | [
"Check",
"if",
"this",
"page",
"is",
"new",
"-",
"that",
"is",
"if",
"it",
"has",
"yet",
"to",
"have",
"been",
"written",
"to",
"the",
"database",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L2537-L2552 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.getClassDropdown | protected function getClassDropdown()
{
$classes = self::page_type_classes();
$currentClass = null;
$result = array();
foreach ($classes as $class) {
$instance = singleton($class);
// if the current page type is this the same as the class type always show th... | php | protected function getClassDropdown()
{
$classes = self::page_type_classes();
$currentClass = null;
$result = array();
foreach ($classes as $class) {
$instance = singleton($class);
// if the current page type is this the same as the class type always show th... | [
"protected",
"function",
"getClassDropdown",
"(",
")",
"{",
"$",
"classes",
"=",
"self",
"::",
"page_type_classes",
"(",
")",
";",
"$",
"currentClass",
"=",
"null",
";",
"$",
"result",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"classes",
"as",
... | Get the class dropdown used in the CMS to change the class of a page. This returns the list of options in the
dropdown as a Map from class name to singular name. Filters by {@link SiteTree->canCreate()}, as well as
{@link SiteTree::$needs_permission}.
@return array | [
"Get",
"the",
"class",
"dropdown",
"used",
"in",
"the",
"CMS",
"to",
"change",
"the",
"class",
"of",
"a",
"page",
".",
"This",
"returns",
"the",
"list",
"of",
"options",
"in",
"the",
"dropdown",
"as",
"a",
"Map",
"from",
"class",
"name",
"to",
"singula... | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L2561-L2610 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.allowedChildren | public function allowedChildren()
{
if (isset(static::$_allowedChildren[$this->ClassName])) {
$allowedChildren = static::$_allowedChildren[$this->ClassName];
} else {
// Get config based on old FIRST_SET rules
$candidates = null;
$class = get_class($th... | php | public function allowedChildren()
{
if (isset(static::$_allowedChildren[$this->ClassName])) {
$allowedChildren = static::$_allowedChildren[$this->ClassName];
} else {
// Get config based on old FIRST_SET rules
$candidates = null;
$class = get_class($th... | [
"public",
"function",
"allowedChildren",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"static",
"::",
"$",
"_allowedChildren",
"[",
"$",
"this",
"->",
"ClassName",
"]",
")",
")",
"{",
"$",
"allowedChildren",
"=",
"static",
"::",
"$",
"_allowedChildren",
"[",
... | Returns an array of the class names of classes that are allowed to be children of this class.
@return string[] | [
"Returns",
"an",
"array",
"of",
"the",
"class",
"names",
"of",
"classes",
"that",
"are",
"allowed",
"to",
"be",
"children",
"of",
"this",
"class",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L2617-L2658 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.creatableChildren | public function creatableChildren()
{
// Build the list of candidate children
$cache = SiteTree::singleton()->getCreatableChildrenCache();
$cacheKey = $this->generateChildrenCacheKey(Security::getCurrentUser() ? Security::getCurrentUser()->ID : 0);
$children = $cache->get($cacheKey, ... | php | public function creatableChildren()
{
// Build the list of candidate children
$cache = SiteTree::singleton()->getCreatableChildrenCache();
$cacheKey = $this->generateChildrenCacheKey(Security::getCurrentUser() ? Security::getCurrentUser()->ID : 0);
$children = $cache->get($cacheKey, ... | [
"public",
"function",
"creatableChildren",
"(",
")",
"{",
"// Build the list of candidate children",
"$",
"cache",
"=",
"SiteTree",
"::",
"singleton",
"(",
")",
"->",
"getCreatableChildrenCache",
"(",
")",
";",
"$",
"cacheKey",
"=",
"$",
"this",
"->",
"generateChi... | @deprecated 5.0 use creatableChildPages instead
Gets a list of the page types that can be created under this specific page
@return array | [
"@deprecated",
"5",
".",
"0",
"use",
"creatableChildPages",
"instead"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L2667-L2686 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.defaultChild | public function defaultChild()
{
$default = $this->config()->get('default_child');
$allowed = $this->allowedChildren();
if ($allowed) {
if (!$default || !in_array($default, $allowed)) {
$default = reset($allowed);
}
return $default;
... | php | public function defaultChild()
{
$default = $this->config()->get('default_child');
$allowed = $this->allowedChildren();
if ($allowed) {
if (!$default || !in_array($default, $allowed)) {
$default = reset($allowed);
}
return $default;
... | [
"public",
"function",
"defaultChild",
"(",
")",
"{",
"$",
"default",
"=",
"$",
"this",
"->",
"config",
"(",
")",
"->",
"get",
"(",
"'default_child'",
")",
";",
"$",
"allowed",
"=",
"$",
"this",
"->",
"allowedChildren",
"(",
")",
";",
"if",
"(",
"$",
... | Returns the class name of the default class for children of this page.
@return string | [
"Returns",
"the",
"class",
"name",
"of",
"the",
"default",
"class",
"for",
"children",
"of",
"this",
"page",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L2728-L2739 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.setMenuTitle | public function setMenuTitle($value)
{
if ($value == $this->getField("Title")) {
$this->setField("MenuTitle", null);
} else {
$this->setField("MenuTitle", $value);
}
} | php | public function setMenuTitle($value)
{
if ($value == $this->getField("Title")) {
$this->setField("MenuTitle", null);
} else {
$this->setField("MenuTitle", $value);
}
} | [
"public",
"function",
"setMenuTitle",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"==",
"$",
"this",
"->",
"getField",
"(",
"\"Title\"",
")",
")",
"{",
"$",
"this",
"->",
"setField",
"(",
"\"MenuTitle\"",
",",
"null",
")",
";",
"}",
"else",... | Set the menu title for this page.
@param string $value | [
"Set",
"the",
"menu",
"title",
"for",
"this",
"page",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L2772-L2779 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.getStatusFlags | public function getStatusFlags($cached = true)
{
if (!$this->_cache_statusFlags || !$cached) {
$flags = array();
if ($this->isOnLiveOnly()) {
$flags['removedfromdraft'] = array(
'text' => _t(__CLASS__.'.ONLIVEONLYSHORT', 'On live only'),
... | php | public function getStatusFlags($cached = true)
{
if (!$this->_cache_statusFlags || !$cached) {
$flags = array();
if ($this->isOnLiveOnly()) {
$flags['removedfromdraft'] = array(
'text' => _t(__CLASS__.'.ONLIVEONLYSHORT', 'On live only'),
... | [
"public",
"function",
"getStatusFlags",
"(",
"$",
"cached",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_cache_statusFlags",
"||",
"!",
"$",
"cached",
")",
"{",
"$",
"flags",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",... | A flag provides the user with additional data about the current page status, for example a "removed from draft"
status. Each page can have more than one status flag. Returns a map of a unique key to a (localized) title for
the flag. The unique key can be reused as a CSS class. Use the 'updateStatusFlags' extension poin... | [
"A",
"flag",
"provides",
"the",
"user",
"with",
"additional",
"data",
"about",
"the",
"current",
"page",
"status",
"for",
"example",
"a",
"removed",
"from",
"draft",
"status",
".",
"Each",
"page",
"can",
"have",
"more",
"than",
"one",
"status",
"flag",
"."... | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L2796-L2828 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.getTreeTitle | public function getTreeTitle()
{
$children = $this->creatableChildPages();
$flags = $this->getStatusFlags();
$treeTitle = sprintf(
"<span class=\"jstree-pageicon page-icon %s class-%s\"></span><span class=\"item\" data-allowedchildren=\"%s\">%s</span>",
$this->getIcon... | php | public function getTreeTitle()
{
$children = $this->creatableChildPages();
$flags = $this->getStatusFlags();
$treeTitle = sprintf(
"<span class=\"jstree-pageicon page-icon %s class-%s\"></span><span class=\"item\" data-allowedchildren=\"%s\">%s</span>",
$this->getIcon... | [
"public",
"function",
"getTreeTitle",
"(",
")",
"{",
"$",
"children",
"=",
"$",
"this",
"->",
"creatableChildPages",
"(",
")",
";",
"$",
"flags",
"=",
"$",
"this",
"->",
"getStatusFlags",
"(",
")",
";",
"$",
"treeTitle",
"=",
"sprintf",
"(",
"\"<span cla... | getTreeTitle will return three <span> html DOM elements, an empty <span> with the class 'jstree-pageicon' in
front, following by a <span> wrapping around its MenuTitle, then following by a <span> indicating its
publication status.
@return string An HTML string ready to be directly used in a template | [
"getTreeTitle",
"will",
"return",
"three",
"<span",
">",
"html",
"DOM",
"elements",
"an",
"empty",
"<span",
">",
"with",
"the",
"class",
"jstree",
"-",
"pageicon",
"in",
"front",
"following",
"by",
"a",
"<span",
">",
"wrapping",
"around",
"its",
"MenuTitle",... | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L2850-L2874 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.getControllerName | public function getControllerName()
{
if ($controller = Config::inst()->get(static::class, 'controller_name')) {
return $controller;
}
//default controller for SiteTree objects
$controller = ContentController::class;
//go through the ancestry for this class look... | php | public function getControllerName()
{
if ($controller = Config::inst()->get(static::class, 'controller_name')) {
return $controller;
}
//default controller for SiteTree objects
$controller = ContentController::class;
//go through the ancestry for this class look... | [
"public",
"function",
"getControllerName",
"(",
")",
"{",
"if",
"(",
"$",
"controller",
"=",
"Config",
"::",
"inst",
"(",
")",
"->",
"get",
"(",
"static",
"::",
"class",
",",
"'controller_name'",
")",
")",
"{",
"return",
"$",
"controller",
";",
"}",
"/... | Find the controller name by our convention of {$ModelClass}Controller
Can be overriden by config variable
@return string | [
"Find",
"the",
"controller",
"name",
"by",
"our",
"convention",
"of",
"{",
"$ModelClass",
"}",
"Controller",
"Can",
"be",
"overriden",
"by",
"config",
"variable"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L2913-L2947 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.CMSTreeClasses | public function CMSTreeClasses()
{
$classes = sprintf('class-%s', Convert::raw2htmlid(static::class));
if ($this->HasBrokenFile || $this->HasBrokenLink) {
$classes .= " BrokenLink";
}
if (!$this->canAddChildren()) {
$classes .= " nochildren";
}
... | php | public function CMSTreeClasses()
{
$classes = sprintf('class-%s', Convert::raw2htmlid(static::class));
if ($this->HasBrokenFile || $this->HasBrokenLink) {
$classes .= " BrokenLink";
}
if (!$this->canAddChildren()) {
$classes .= " nochildren";
}
... | [
"public",
"function",
"CMSTreeClasses",
"(",
")",
"{",
"$",
"classes",
"=",
"sprintf",
"(",
"'class-%s'",
",",
"Convert",
"::",
"raw2htmlid",
"(",
"static",
"::",
"class",
")",
")",
";",
"if",
"(",
"$",
"this",
"->",
"HasBrokenFile",
"||",
"$",
"this",
... | Return the CSS classes to apply to this node in the CMS tree.
@return string | [
"Return",
"the",
"CSS",
"classes",
"to",
"apply",
"to",
"this",
"node",
"in",
"the",
"CMS",
"tree",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L2954-L2978 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.singular_name | public function singular_name()
{
$base = in_array(static::class, [Page::class, self::class]);
if ($base) {
return $this->config()->get('base_singular_name');
}
return parent::singular_name();
} | php | public function singular_name()
{
$base = in_array(static::class, [Page::class, self::class]);
if ($base) {
return $this->config()->get('base_singular_name');
}
return parent::singular_name();
} | [
"public",
"function",
"singular_name",
"(",
")",
"{",
"$",
"base",
"=",
"in_array",
"(",
"static",
"::",
"class",
",",
"[",
"Page",
"::",
"class",
",",
"self",
"::",
"class",
"]",
")",
";",
"if",
"(",
"$",
"base",
")",
"{",
"return",
"$",
"this",
... | Default singular name for page / sitetree
@return string | [
"Default",
"singular",
"name",
"for",
"page",
"/",
"sitetree"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L3039-L3046 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.plural_name | public function plural_name()
{
$base = in_array(static::class, [Page::class, self::class]);
if ($base) {
return $this->config()->get('base_plural_name');
}
return parent::plural_name();
} | php | public function plural_name()
{
$base = in_array(static::class, [Page::class, self::class]);
if ($base) {
return $this->config()->get('base_plural_name');
}
return parent::plural_name();
} | [
"public",
"function",
"plural_name",
"(",
")",
"{",
"$",
"base",
"=",
"in_array",
"(",
"static",
"::",
"class",
",",
"[",
"Page",
"::",
"class",
",",
"self",
"::",
"class",
"]",
")",
";",
"if",
"(",
"$",
"base",
")",
"{",
"return",
"$",
"this",
"... | Default plural name for page / sitetree
@return string | [
"Default",
"plural",
"name",
"for",
"page",
"/",
"sitetree"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L3053-L3060 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.getPageIconURL | public function getPageIconURL()
{
$icon = $this->config()->get('icon');
if (!$icon) {
return null;
}
if (strpos($icon, 'data:image/') !== false) {
return $icon;
}
// Icon is relative resource
$iconResource = ModuleResourceLoader::sing... | php | public function getPageIconURL()
{
$icon = $this->config()->get('icon');
if (!$icon) {
return null;
}
if (strpos($icon, 'data:image/') !== false) {
return $icon;
}
// Icon is relative resource
$iconResource = ModuleResourceLoader::sing... | [
"public",
"function",
"getPageIconURL",
"(",
")",
"{",
"$",
"icon",
"=",
"$",
"this",
"->",
"config",
"(",
")",
"->",
"get",
"(",
"'icon'",
")",
";",
"if",
"(",
"!",
"$",
"icon",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"strpos",
"(",
"... | Generate link to this page's icon
@return string | [
"Generate",
"link",
"to",
"this",
"page",
"s",
"icon"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L3067-L3090 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.classDescription | public function classDescription()
{
$base = in_array(static::class, [Page::class, self::class]);
if ($base) {
return $this->config()->get('base_description');
}
return $this->config()->get('description');
} | php | public function classDescription()
{
$base = in_array(static::class, [Page::class, self::class]);
if ($base) {
return $this->config()->get('base_description');
}
return $this->config()->get('description');
} | [
"public",
"function",
"classDescription",
"(",
")",
"{",
"$",
"base",
"=",
"in_array",
"(",
"static",
"::",
"class",
",",
"[",
"Page",
"::",
"class",
",",
"self",
"::",
"class",
"]",
")",
";",
"if",
"(",
"$",
"base",
")",
"{",
"return",
"$",
"this"... | Get description for this page type
@return string|null | [
"Get",
"description",
"for",
"this",
"page",
"type"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L3097-L3104 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.provideI18nEntities | public function provideI18nEntities()
{
$entities = parent::provideI18nEntities();
// Add optional description
$description = $this->classDescription();
if ($description) {
$entities[static::class . '.DESCRIPTION'] = $description;
}
return $entities;
... | php | public function provideI18nEntities()
{
$entities = parent::provideI18nEntities();
// Add optional description
$description = $this->classDescription();
if ($description) {
$entities[static::class . '.DESCRIPTION'] = $description;
}
return $entities;
... | [
"public",
"function",
"provideI18nEntities",
"(",
")",
"{",
"$",
"entities",
"=",
"parent",
"::",
"provideI18nEntities",
"(",
")",
";",
"// Add optional description",
"$",
"description",
"=",
"$",
"this",
"->",
"classDescription",
"(",
")",
";",
"if",
"(",
"$"... | Overloaded to also provide entities for 'Page' class which is usually located in custom code, hence textcollector
picks it up for the wrong folder.
@return array | [
"Overloaded",
"to",
"also",
"provide",
"entities",
"for",
"Page",
"class",
"which",
"is",
"usually",
"located",
"in",
"custom",
"code",
"hence",
"textcollector",
"picks",
"it",
"up",
"for",
"the",
"wrong",
"folder",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L3126-L3136 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.updateDependentPages | protected function updateDependentPages()
{
// Skip live stage
if (Versioned::get_stage() === Versioned::LIVE) {
return;
}
// Need to flush cache to avoid outdated versionnumber references
$this->flushCache();
// Need to mark pages depending to this one ... | php | protected function updateDependentPages()
{
// Skip live stage
if (Versioned::get_stage() === Versioned::LIVE) {
return;
}
// Need to flush cache to avoid outdated versionnumber references
$this->flushCache();
// Need to mark pages depending to this one ... | [
"protected",
"function",
"updateDependentPages",
"(",
")",
"{",
"// Skip live stage",
"if",
"(",
"Versioned",
"::",
"get_stage",
"(",
")",
"===",
"Versioned",
"::",
"LIVE",
")",
"{",
"return",
";",
"}",
"// Need to flush cache to avoid outdated versionnumber references"... | Update dependant pages | [
"Update",
"dependant",
"pages"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L3171-L3190 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.getExcludedURLSegments | protected function getExcludedURLSegments()
{
$excludes = [];
// Build from rules
foreach (Director::config()->get('rules') as $pattern => $rule) {
$route = explode('/', $pattern);
if (!empty($route) && strpos($route[0], '$') === false) {
$excludes[] ... | php | protected function getExcludedURLSegments()
{
$excludes = [];
// Build from rules
foreach (Director::config()->get('rules') as $pattern => $rule) {
$route = explode('/', $pattern);
if (!empty($route) && strpos($route[0], '$') === false) {
$excludes[] ... | [
"protected",
"function",
"getExcludedURLSegments",
"(",
")",
"{",
"$",
"excludes",
"=",
"[",
"]",
";",
"// Build from rules",
"foreach",
"(",
"Director",
"::",
"config",
"(",
")",
"->",
"get",
"(",
"'rules'",
")",
"as",
"$",
"pattern",
"=>",
"$",
"rule",
... | Get the list of excluded root URL segments
@return array List of lowercase urlsegments | [
"Get",
"the",
"list",
"of",
"excluded",
"root",
"URL",
"segments"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L3208-L3227 |
silverstripe/silverstripe-cms | code/Controllers/CMSSiteTreeFilter_StatusDeletedPages.php | CMSSiteTreeFilter_StatusDeletedPages.getFilteredPages | public function getFilteredPages()
{
$pages = Versioned::get_including_deleted(SiteTree::class);
$pages = $this->applyDefaultFilters($pages);
$pages = $pages->filterByCallback(function (SiteTree $page) {
// Doesn't exist on either stage or live
return $page->isArchiv... | php | public function getFilteredPages()
{
$pages = Versioned::get_including_deleted(SiteTree::class);
$pages = $this->applyDefaultFilters($pages);
$pages = $pages->filterByCallback(function (SiteTree $page) {
// Doesn't exist on either stage or live
return $page->isArchiv... | [
"public",
"function",
"getFilteredPages",
"(",
")",
"{",
"$",
"pages",
"=",
"Versioned",
"::",
"get_including_deleted",
"(",
"SiteTree",
"::",
"class",
")",
";",
"$",
"pages",
"=",
"$",
"this",
"->",
"applyDefaultFilters",
"(",
"$",
"pages",
")",
";",
"$",... | Filters out all pages who's status is set to "Deleted".
@see {@link SiteTree::getStatusFlags()}
@return SS_List | [
"Filters",
"out",
"all",
"pages",
"who",
"s",
"status",
"is",
"set",
"to",
"Deleted",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSSiteTreeFilter_StatusDeletedPages.php#L36-L46 |
silverstripe/silverstripe-cms | code/Tasks/RemoveOrphanedPagesTask.php | RemoveOrphanedPagesTask.getOrphanedPages | public function getOrphanedPages($class = SiteTree::class, $filter = array(), $sort = null, $join = null, $limit = null)
{
// Alter condition
$table = DataObject::getSchema()->tableName($class);
if (empty($filter)) {
$where = array();
} elseif (is_array($filter)) {
... | php | public function getOrphanedPages($class = SiteTree::class, $filter = array(), $sort = null, $join = null, $limit = null)
{
// Alter condition
$table = DataObject::getSchema()->tableName($class);
if (empty($filter)) {
$where = array();
} elseif (is_array($filter)) {
... | [
"public",
"function",
"getOrphanedPages",
"(",
"$",
"class",
"=",
"SiteTree",
"::",
"class",
",",
"$",
"filter",
"=",
"array",
"(",
")",
",",
"$",
"sort",
"=",
"null",
",",
"$",
"join",
"=",
"null",
",",
"$",
"limit",
"=",
"null",
")",
"{",
"// Alt... | Gets all orphans from "Stage" and "Live" stages.
@param string $class
@param array $filter
@param string $sort
@param string $join
@param int|array $limit
@return SS_List | [
"Gets",
"all",
"orphans",
"from",
"Stage",
"and",
"Live",
"stages",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Tasks/RemoveOrphanedPagesTask.php#L344-L375 |
silverstripe/silverstripe-cms | code/Model/VirtualPage.php | VirtualPage.getVirtualFields | public function getVirtualFields()
{
// Check if copied page exists
$record = $this->CopyContentFrom();
if (!$record || !$record->exists()) {
return array();
}
// Diff db with non-virtual fields
$fields = array_keys(static::getSchema()->fieldSpecs($record... | php | public function getVirtualFields()
{
// Check if copied page exists
$record = $this->CopyContentFrom();
if (!$record || !$record->exists()) {
return array();
}
// Diff db with non-virtual fields
$fields = array_keys(static::getSchema()->fieldSpecs($record... | [
"public",
"function",
"getVirtualFields",
"(",
")",
"{",
"// Check if copied page exists",
"$",
"record",
"=",
"$",
"this",
"->",
"CopyContentFrom",
"(",
")",
";",
"if",
"(",
"!",
"$",
"record",
"||",
"!",
"$",
"record",
"->",
"exists",
"(",
")",
")",
"{... | Generates the array of fields required for the page type.
@return array | [
"Generates",
"the",
"array",
"of",
"fields",
"required",
"for",
"the",
"page",
"type",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/VirtualPage.php#L90-L102 |
silverstripe/silverstripe-cms | code/Model/VirtualPage.php | VirtualPage.MetaTags | public function MetaTags($includeTitle = true)
{
$tags = parent::MetaTags($includeTitle);
$copied = $this->CopyContentFrom();
if ($copied && $copied->exists()) {
$tags .= HTML::createTag('link', [
'rel' => 'canonical',
'href' => $copied->Link()
... | php | public function MetaTags($includeTitle = true)
{
$tags = parent::MetaTags($includeTitle);
$copied = $this->CopyContentFrom();
if ($copied && $copied->exists()) {
$tags .= HTML::createTag('link', [
'rel' => 'canonical',
'href' => $copied->Link()
... | [
"public",
"function",
"MetaTags",
"(",
"$",
"includeTitle",
"=",
"true",
")",
"{",
"$",
"tags",
"=",
"parent",
"::",
"MetaTags",
"(",
"$",
"includeTitle",
")",
";",
"$",
"copied",
"=",
"$",
"this",
"->",
"CopyContentFrom",
"(",
")",
";",
"if",
"(",
"... | For VirtualPage, add a canonical link tag linking to the original page
See TRAC #6828 & http://support.google.com/webmasters/bin/answer.py?hl=en&answer=139394
@param boolean $includeTitle Show default <title>-tag, set to false for custom templating
@return string The XHTML metatags | [
"For",
"VirtualPage",
"add",
"a",
"canonical",
"link",
"tag",
"linking",
"to",
"the",
"original",
"page",
"See",
"TRAC",
"#6828",
"&",
"http",
":",
"//",
"support",
".",
"google",
".",
"com",
"/",
"webmasters",
"/",
"bin",
"/",
"answer",
".",
"py?hl",
... | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/VirtualPage.php#L143-L155 |
silverstripe/silverstripe-cms | code/Model/VirtualPage.php | VirtualPage.isPublishable | public function isPublishable()
{
// No source
if (!$this->CopyContentFrom() || !$this->CopyContentFrom()->ID) {
return false;
}
// Unpublished source
if (!Versioned::get_versionnumber_by_stage(
SiteTree::class,
'Live',
$this->... | php | public function isPublishable()
{
// No source
if (!$this->CopyContentFrom() || !$this->CopyContentFrom()->ID) {
return false;
}
// Unpublished source
if (!Versioned::get_versionnumber_by_stage(
SiteTree::class,
'Live',
$this->... | [
"public",
"function",
"isPublishable",
"(",
")",
"{",
"// No source",
"if",
"(",
"!",
"$",
"this",
"->",
"CopyContentFrom",
"(",
")",
"||",
"!",
"$",
"this",
"->",
"CopyContentFrom",
"(",
")",
"->",
"ID",
")",
"{",
"return",
"false",
";",
"}",
"// Unpu... | Returns true if is page is publishable by anyone at all
Return false if the source page isn't published yet.
Note that isPublishable doesn't affect ete from live, only publish. | [
"Returns",
"true",
"if",
"is",
"page",
"is",
"publishable",
"by",
"anyone",
"at",
"all",
"Return",
"false",
"if",
"the",
"source",
"page",
"isn",
"t",
"published",
"yet",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/VirtualPage.php#L194-L212 |
silverstripe/silverstripe-cms | code/Model/VirtualPage.php | VirtualPage.getCMSFields | public function getCMSFields()
{
$this->beforeUpdateCMSFields(function (FieldList $fields) {
// Setup the linking to the original page.
$copyContentFromField = TreeDropdownField::create(
'CopyContentFromID',
_t(self::class . '.CHOOSE', "Linked Page"),
... | php | public function getCMSFields()
{
$this->beforeUpdateCMSFields(function (FieldList $fields) {
// Setup the linking to the original page.
$copyContentFromField = TreeDropdownField::create(
'CopyContentFromID',
_t(self::class . '.CHOOSE', "Linked Page"),
... | [
"public",
"function",
"getCMSFields",
"(",
")",
"{",
"$",
"this",
"->",
"beforeUpdateCMSFields",
"(",
"function",
"(",
"FieldList",
"$",
"fields",
")",
"{",
"// Setup the linking to the original page.",
"$",
"copyContentFromField",
"=",
"TreeDropdownField",
"::",
"cre... | Generate the CMS fields from the fields from the original page. | [
"Generate",
"the",
"CMS",
"fields",
"from",
"the",
"fields",
"from",
"the",
"original",
"page",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/VirtualPage.php#L217-L287 |
silverstripe/silverstripe-cms | code/Model/VirtualPage.php | VirtualPage.refreshFromCopied | protected function refreshFromCopied()
{
// Skip if copied record isn't available
$source = $this->CopyContentFrom();
if (!$source || !$source->exists()) {
return;
}
// We also want to copy certain, but only if we're copying the source page for the first
... | php | protected function refreshFromCopied()
{
// Skip if copied record isn't available
$source = $this->CopyContentFrom();
if (!$source || !$source->exists()) {
return;
}
// We also want to copy certain, but only if we're copying the source page for the first
... | [
"protected",
"function",
"refreshFromCopied",
"(",
")",
"{",
"// Skip if copied record isn't available",
"$",
"source",
"=",
"$",
"this",
"->",
"CopyContentFrom",
"(",
")",
";",
"if",
"(",
"!",
"$",
"source",
"||",
"!",
"$",
"source",
"->",
"exists",
"(",
")... | Copy any fields from the copied record to bootstrap /backup | [
"Copy",
"any",
"fields",
"from",
"the",
"copied",
"record",
"to",
"bootstrap",
"/",
"backup"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/VirtualPage.php#L298-L318 |
silverstripe/silverstripe-cms | code/Model/VirtualPage.php | VirtualPage.getViewerTemplates | public function getViewerTemplates($suffix = '')
{
$copy = $this->CopyContentFrom();
if ($copy && $copy->exists()) {
return $copy->getViewerTemplates($suffix);
}
return parent::getViewerTemplates($suffix);
} | php | public function getViewerTemplates($suffix = '')
{
$copy = $this->CopyContentFrom();
if ($copy && $copy->exists()) {
return $copy->getViewerTemplates($suffix);
}
return parent::getViewerTemplates($suffix);
} | [
"public",
"function",
"getViewerTemplates",
"(",
"$",
"suffix",
"=",
"''",
")",
"{",
"$",
"copy",
"=",
"$",
"this",
"->",
"CopyContentFrom",
"(",
")",
";",
"if",
"(",
"$",
"copy",
"&&",
"$",
"copy",
"->",
"exists",
"(",
")",
")",
"{",
"return",
"$"... | Use the target page's class name for fetching templates - as we need to take on its appearance
@param string $suffix
@return array | [
"Use",
"the",
"target",
"page",
"s",
"class",
"name",
"for",
"fetching",
"templates",
"-",
"as",
"we",
"need",
"to",
"take",
"on",
"its",
"appearance"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/VirtualPage.php#L402-L410 |
silverstripe/silverstripe-cms | code/Model/VirtualPage.php | VirtualPage.isFieldVirtualised | public function isFieldVirtualised($field)
{
// Don't defer if field is non-virtualised
$ignore = $this->getNonVirtualisedFields();
if (in_array($field, $ignore)) {
return false;
}
// Don't defer if no virtual page
$copied = $this->CopyContentFrom();
... | php | public function isFieldVirtualised($field)
{
// Don't defer if field is non-virtualised
$ignore = $this->getNonVirtualisedFields();
if (in_array($field, $ignore)) {
return false;
}
// Don't defer if no virtual page
$copied = $this->CopyContentFrom();
... | [
"public",
"function",
"isFieldVirtualised",
"(",
"$",
"field",
")",
"{",
"// Don't defer if field is non-virtualised",
"$",
"ignore",
"=",
"$",
"this",
"->",
"getNonVirtualisedFields",
"(",
")",
";",
"if",
"(",
"in_array",
"(",
"$",
"field",
",",
"$",
"ignore",
... | Check if given field is virtualised
@param string $field
@return bool | [
"Check",
"if",
"given",
"field",
"is",
"virtualised"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/VirtualPage.php#L447-L463 |
silverstripe/silverstripe-cms | code/Model/VirtualPage.php | VirtualPage.castingHelper | public function castingHelper($field)
{
$copy = $this->CopyContentFrom();
if ($copy && $copy->exists() && ($helper = $copy->castingHelper($field))) {
return $helper;
}
return parent::castingHelper($field);
} | php | public function castingHelper($field)
{
$copy = $this->CopyContentFrom();
if ($copy && $copy->exists() && ($helper = $copy->castingHelper($field))) {
return $helper;
}
return parent::castingHelper($field);
} | [
"public",
"function",
"castingHelper",
"(",
"$",
"field",
")",
"{",
"$",
"copy",
"=",
"$",
"this",
"->",
"CopyContentFrom",
"(",
")",
";",
"if",
"(",
"$",
"copy",
"&&",
"$",
"copy",
"->",
"exists",
"(",
")",
"&&",
"(",
"$",
"helper",
"=",
"$",
"c... | Return the "casting helper" (a piece of PHP code that when evaluated creates a casted value object) for a field
on this object.
@param string $field
@return string | [
"Return",
"the",
"casting",
"helper",
"(",
"a",
"piece",
"of",
"PHP",
"code",
"that",
"when",
"evaluated",
"creates",
"a",
"casted",
"value",
"object",
")",
"for",
"a",
"field",
"on",
"this",
"object",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/VirtualPage.php#L501-L508 |
silverstripe/silverstripe-cms | code/Model/VirtualPage.php | VirtualPage.allMethodNames | public function allMethodNames($custom = false)
{
$methods = parent::allMethodNames($custom);
if ($copy = $this->CopyContentFrom()) {
$methods = array_merge($methods, $copy->allMethodNames($custom));
}
return $methods;
} | php | public function allMethodNames($custom = false)
{
$methods = parent::allMethodNames($custom);
if ($copy = $this->CopyContentFrom()) {
$methods = array_merge($methods, $copy->allMethodNames($custom));
}
return $methods;
} | [
"public",
"function",
"allMethodNames",
"(",
"$",
"custom",
"=",
"false",
")",
"{",
"$",
"methods",
"=",
"parent",
"::",
"allMethodNames",
"(",
"$",
"custom",
")",
";",
"if",
"(",
"$",
"copy",
"=",
"$",
"this",
"->",
"CopyContentFrom",
"(",
")",
")",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/VirtualPage.php#L513-L522 |
silverstripe/silverstripe-cms | code/Controllers/LeftAndMainPageIconsExtension.php | LeftAndMainPageIconsExtension.generatePageIconsCss | public function generatePageIconsCss()
{
$css = '';
$classes = ClassInfo::subclassesFor(SiteTree::class);
foreach ($classes as $class) {
$iconURL = SiteTree::singleton($class)->getPageIconURL();
if ($iconURL) {
$cssClass = Convert::raw2htmlid($class);
... | php | public function generatePageIconsCss()
{
$css = '';
$classes = ClassInfo::subclassesFor(SiteTree::class);
foreach ($classes as $class) {
$iconURL = SiteTree::singleton($class)->getPageIconURL();
if ($iconURL) {
$cssClass = Convert::raw2htmlid($class);
... | [
"public",
"function",
"generatePageIconsCss",
"(",
")",
"{",
"$",
"css",
"=",
"''",
";",
"$",
"classes",
"=",
"ClassInfo",
"::",
"subclassesFor",
"(",
"SiteTree",
"::",
"class",
")",
";",
"foreach",
"(",
"$",
"classes",
"as",
"$",
"class",
")",
"{",
"$... | Include CSS for page icons. We're not using the JSTree 'types' option
because it causes too much performance overhead just to add some icons.
@return string CSS | [
"Include",
"CSS",
"for",
"page",
"icons",
".",
"We",
"re",
"not",
"using",
"the",
"JSTree",
"types",
"option",
"because",
"it",
"causes",
"too",
"much",
"performance",
"overhead",
"just",
"to",
"add",
"some",
"icons",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/LeftAndMainPageIconsExtension.php#L29-L42 |
silverstripe/silverstripe-cms | code/Controllers/CMSMain.php | CMSMain.Link | public function Link($action = null)
{
$link = Controller::join_links(
AdminRootController::admin_url(),
$this->config()->get('url_segment'), // in case we want to change the segment
'/', // trailing slash needed if $action is null!
"$action"
);
... | php | public function Link($action = null)
{
$link = Controller::join_links(
AdminRootController::admin_url(),
$this->config()->get('url_segment'), // in case we want to change the segment
'/', // trailing slash needed if $action is null!
"$action"
);
... | [
"public",
"function",
"Link",
"(",
"$",
"action",
"=",
"null",
")",
"{",
"$",
"link",
"=",
"Controller",
"::",
"join_links",
"(",
"AdminRootController",
"::",
"admin_url",
"(",
")",
",",
"$",
"this",
"->",
"config",
"(",
")",
"->",
"get",
"(",
"'url_se... | Override {@link LeftAndMain} Link to allow blank URL segment for CMSMain.
@param string|null $action Action to link to.
@return string | [
"Override",
"{",
"@link",
"LeftAndMain",
"}",
"Link",
"to",
"allow",
"blank",
"URL",
"segment",
"for",
"CMSMain",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSMain.php#L290-L300 |
silverstripe/silverstripe-cms | code/Controllers/CMSMain.php | CMSMain.SiteTreeAsUL | public function SiteTreeAsUL()
{
$treeClass = $this->config()->get('tree_class');
$filter = $this->getSearchFilter();
DataObject::singleton($treeClass)->prepopulateTreeDataCache(null, [
'childrenMethod' => $filter ? $filter->getChildrenMethod() : 'AllChildrenIncludingDeleted',
... | php | public function SiteTreeAsUL()
{
$treeClass = $this->config()->get('tree_class');
$filter = $this->getSearchFilter();
DataObject::singleton($treeClass)->prepopulateTreeDataCache(null, [
'childrenMethod' => $filter ? $filter->getChildrenMethod() : 'AllChildrenIncludingDeleted',
... | [
"public",
"function",
"SiteTreeAsUL",
"(",
")",
"{",
"$",
"treeClass",
"=",
"$",
"this",
"->",
"config",
"(",
")",
"->",
"get",
"(",
"'tree_class'",
")",
";",
"$",
"filter",
"=",
"$",
"this",
"->",
"getSearchFilter",
"(",
")",
";",
"DataObject",
"::",
... | Return the entire site tree as a nested set of ULs | [
"Return",
"the",
"entire",
"site",
"tree",
"as",
"a",
"nested",
"set",
"of",
"ULs"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSMain.php#L500-L515 |
silverstripe/silverstripe-cms | code/Controllers/CMSMain.php | CMSMain.getSiteTreeFor | public function getSiteTreeFor(
$className,
$rootID = null,
$childrenMethod = null,
$numChildrenMethod = null,
$filterFunction = null,
$nodeCountThreshold = null
) {
$nodeCountThreshold = is_null($nodeCountThreshold) ? Config::inst()->get($className, 'node_thr... | php | public function getSiteTreeFor(
$className,
$rootID = null,
$childrenMethod = null,
$numChildrenMethod = null,
$filterFunction = null,
$nodeCountThreshold = null
) {
$nodeCountThreshold = is_null($nodeCountThreshold) ? Config::inst()->get($className, 'node_thr... | [
"public",
"function",
"getSiteTreeFor",
"(",
"$",
"className",
",",
"$",
"rootID",
"=",
"null",
",",
"$",
"childrenMethod",
"=",
"null",
",",
"$",
"numChildrenMethod",
"=",
"null",
",",
"$",
"filterFunction",
"=",
"null",
",",
"$",
"nodeCountThreshold",
"=",... | Get a site tree HTML listing which displays the nodes under the given criteria.
@param string $className The class of the root object
@param string $rootID The ID of the root object. If this is null then a complete tree will be
shown
@param string $childrenMethod The method to call to get the children of the tree. Fo... | [
"Get",
"a",
"site",
"tree",
"HTML",
"listing",
"which",
"displays",
"the",
"nodes",
"under",
"the",
"given",
"criteria",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSMain.php#L530-L588 |
silverstripe/silverstripe-cms | code/Controllers/CMSMain.php | CMSMain.getTreeNodeCustomisations | protected function getTreeNodeCustomisations()
{
$rootTitle = $this->getCMSTreeTitle();
return function (SiteTree $node) use ($rootTitle) {
return [
'listViewLink' => $this->LinkListViewChildren($node->ID),
'rootTitle' => $rootTitle,
'extra... | php | protected function getTreeNodeCustomisations()
{
$rootTitle = $this->getCMSTreeTitle();
return function (SiteTree $node) use ($rootTitle) {
return [
'listViewLink' => $this->LinkListViewChildren($node->ID),
'rootTitle' => $rootTitle,
'extra... | [
"protected",
"function",
"getTreeNodeCustomisations",
"(",
")",
"{",
"$",
"rootTitle",
"=",
"$",
"this",
"->",
"getCMSTreeTitle",
"(",
")",
";",
"return",
"function",
"(",
"SiteTree",
"$",
"node",
")",
"use",
"(",
"$",
"rootTitle",
")",
"{",
"return",
"[",... | Get callback to determine template customisations for nodes
@return callable | [
"Get",
"callback",
"to",
"determine",
"template",
"customisations",
"for",
"nodes"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSMain.php#L596-L614 |
silverstripe/silverstripe-cms | code/Controllers/CMSMain.php | CMSMain.getTreeNodeClasses | public function getTreeNodeClasses(SiteTree $node)
{
// Get classes from object
$classes = $node->CMSTreeClasses();
// Get status flag classes
$flags = $node->getStatusFlags();
if ($flags) {
$statuses = array_keys($flags);
foreach ($statuses as $s) {
... | php | public function getTreeNodeClasses(SiteTree $node)
{
// Get classes from object
$classes = $node->CMSTreeClasses();
// Get status flag classes
$flags = $node->getStatusFlags();
if ($flags) {
$statuses = array_keys($flags);
foreach ($statuses as $s) {
... | [
"public",
"function",
"getTreeNodeClasses",
"(",
"SiteTree",
"$",
"node",
")",
"{",
"// Get classes from object",
"$",
"classes",
"=",
"$",
"node",
"->",
"CMSTreeClasses",
"(",
")",
";",
"// Get status flag classes",
"$",
"flags",
"=",
"$",
"node",
"->",
"getSta... | Get extra CSS classes for a page's tree node
@param SiteTree $node
@return string | [
"Get",
"extra",
"CSS",
"classes",
"for",
"a",
"page",
"s",
"tree",
"node"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSMain.php#L622-L646 |
silverstripe/silverstripe-cms | code/Controllers/CMSMain.php | CMSMain.getsubtree | public function getsubtree($request)
{
$html = $this->getSiteTreeFor(
$this->config()->get('tree_class'),
$request->getVar('ID'),
null,
null,
null,
$request->getVar('minNodeCount')
);
// Trim off the outer tag
$... | php | public function getsubtree($request)
{
$html = $this->getSiteTreeFor(
$this->config()->get('tree_class'),
$request->getVar('ID'),
null,
null,
null,
$request->getVar('minNodeCount')
);
// Trim off the outer tag
$... | [
"public",
"function",
"getsubtree",
"(",
"$",
"request",
")",
"{",
"$",
"html",
"=",
"$",
"this",
"->",
"getSiteTreeFor",
"(",
"$",
"this",
"->",
"config",
"(",
")",
"->",
"get",
"(",
"'tree_class'",
")",
",",
"$",
"request",
"->",
"getVar",
"(",
"'I... | Get a subtree underneath the request param 'ID'.
If ID = 0, then get the whole tree.
@param HTTPRequest $request
@return string | [
"Get",
"a",
"subtree",
"underneath",
"the",
"request",
"param",
"ID",
".",
"If",
"ID",
"=",
"0",
"then",
"get",
"the",
"whole",
"tree",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSMain.php#L655-L671 |
silverstripe/silverstripe-cms | code/Controllers/CMSMain.php | CMSMain.updatetreenodes | public function updatetreenodes($request)
{
$data = array();
$ids = explode(',', $request->getVar('ids'));
foreach ($ids as $id) {
if ($id === "") {
continue; // $id may be a blank string, which is invalid and should be skipped over
}
$rec... | php | public function updatetreenodes($request)
{
$data = array();
$ids = explode(',', $request->getVar('ids'));
foreach ($ids as $id) {
if ($id === "") {
continue; // $id may be a blank string, which is invalid and should be skipped over
}
$rec... | [
"public",
"function",
"updatetreenodes",
"(",
"$",
"request",
")",
"{",
"$",
"data",
"=",
"array",
"(",
")",
";",
"$",
"ids",
"=",
"explode",
"(",
"','",
",",
"$",
"request",
"->",
"getVar",
"(",
"'ids'",
")",
")",
";",
"foreach",
"(",
"$",
"ids",
... | Allows requesting a view update on specific tree nodes.
Similar to {@link getsubtree()}, but doesn't enforce loading
all children with the node. Useful to refresh views after
state modifications, e.g. saving a form.
@param HTTPRequest $request
@return HTTPResponse | [
"Allows",
"requesting",
"a",
"view",
"update",
"on",
"specific",
"tree",
"nodes",
".",
"Similar",
"to",
"{",
"@link",
"getsubtree",
"()",
"}",
"but",
"doesn",
"t",
"enforce",
"loading",
"all",
"children",
"with",
"the",
"node",
".",
"Useful",
"to",
"refres... | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSMain.php#L682-L738 |
silverstripe/silverstripe-cms | code/Controllers/CMSMain.php | CMSMain.savetreenode | public function savetreenode($request)
{
if (!SecurityToken::inst()->checkRequest($request)) {
return $this->httpError(400);
}
if (!$this->CanOrganiseSitetree()) {
return $this->httpError(
403,
_t(
__CLASS__.'.CANT_R... | php | public function savetreenode($request)
{
if (!SecurityToken::inst()->checkRequest($request)) {
return $this->httpError(400);
}
if (!$this->CanOrganiseSitetree()) {
return $this->httpError(
403,
_t(
__CLASS__.'.CANT_R... | [
"public",
"function",
"savetreenode",
"(",
"$",
"request",
")",
"{",
"if",
"(",
"!",
"SecurityToken",
"::",
"inst",
"(",
")",
"->",
"checkRequest",
"(",
"$",
"request",
")",
")",
"{",
"return",
"$",
"this",
"->",
"httpError",
"(",
"400",
")",
";",
"}... | Update the position and parent of a tree node.
Only saves the node if changes were made.
Required data:
- 'ID': The moved node
- 'ParentID': New parent relation of the moved node (0 for root)
- 'SiblingIDs': Array of all sibling nodes to the moved node (incl. the node itself).
In case of a 'ParentID' change, relates t... | [
"Update",
"the",
"position",
"and",
"parent",
"of",
"a",
"tree",
"node",
".",
"Only",
"saves",
"the",
"node",
"if",
"changes",
"were",
"made",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSMain.php#L754-L863 |
silverstripe/silverstripe-cms | code/Controllers/CMSMain.php | CMSMain.getSearchFieldSchema | public function getSearchFieldSchema()
{
$schemaUrl = $this->Link('schema/SearchForm');
$context = $this->getSearchContext();
$params = $this->getRequest()->requestVar('q') ?: [];
$context->setSearchParams($params);
$placeholder = _t('SilverStripe\\CMS\\Search\\SearchForm.F... | php | public function getSearchFieldSchema()
{
$schemaUrl = $this->Link('schema/SearchForm');
$context = $this->getSearchContext();
$params = $this->getRequest()->requestVar('q') ?: [];
$context->setSearchParams($params);
$placeholder = _t('SilverStripe\\CMS\\Search\\SearchForm.F... | [
"public",
"function",
"getSearchFieldSchema",
"(",
")",
"{",
"$",
"schemaUrl",
"=",
"$",
"this",
"->",
"Link",
"(",
"'schema/SearchForm'",
")",
";",
"$",
"context",
"=",
"$",
"this",
"->",
"getSearchContext",
"(",
")",
";",
"$",
"params",
"=",
"$",
"this... | Returns the search form schema for the current model
@return string | [
"Returns",
"the",
"search",
"form",
"schema",
"for",
"the",
"current",
"model"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSMain.php#L911-L936 |
silverstripe/silverstripe-cms | code/Controllers/CMSMain.php | CMSMain.getSearchForm | public function getSearchForm()
{
// Create the fields
$dateFrom = DateField::create(
'Search__LastEditedFrom',
_t('SilverStripe\\CMS\\Search\\SearchForm.FILTERDATEFROM', 'From')
)->setLocale(Security::getCurrentUser()->Locale);
$dateTo = DateField::create(
... | php | public function getSearchForm()
{
// Create the fields
$dateFrom = DateField::create(
'Search__LastEditedFrom',
_t('SilverStripe\\CMS\\Search\\SearchForm.FILTERDATEFROM', 'From')
)->setLocale(Security::getCurrentUser()->Locale);
$dateTo = DateField::create(
... | [
"public",
"function",
"getSearchForm",
"(",
")",
"{",
"// Create the fields",
"$",
"dateFrom",
"=",
"DateField",
"::",
"create",
"(",
"'Search__LastEditedFrom'",
",",
"_t",
"(",
"'SilverStripe\\\\CMS\\\\Search\\\\SearchForm.FILTERDATEFROM'",
",",
"'From'",
")",
")",
"->... | Returns a Form for page searching for use in templates.
Can be modified from a decorator by a 'updateSearchForm' method
@return Form | [
"Returns",
"a",
"Form",
"for",
"page",
"searching",
"for",
"use",
"in",
"templates",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSMain.php#L945-L1007 |
silverstripe/silverstripe-cms | code/Controllers/CMSMain.php | CMSMain.getPageTypes | protected function getPageTypes()
{
$pageTypes = array();
foreach (SiteTree::page_type_classes() as $pageTypeClass) {
$pageTypes[$pageTypeClass] = SiteTree::singleton($pageTypeClass)->i18n_singular_name();
}
asort($pageTypes);
return $pageTypes;
} | php | protected function getPageTypes()
{
$pageTypes = array();
foreach (SiteTree::page_type_classes() as $pageTypeClass) {
$pageTypes[$pageTypeClass] = SiteTree::singleton($pageTypeClass)->i18n_singular_name();
}
asort($pageTypes);
return $pageTypes;
} | [
"protected",
"function",
"getPageTypes",
"(",
")",
"{",
"$",
"pageTypes",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"SiteTree",
"::",
"page_type_classes",
"(",
")",
"as",
"$",
"pageTypeClass",
")",
"{",
"$",
"pageTypes",
"[",
"$",
"pageTypeClass",
"]",
... | Returns a sorted array suitable for a dropdown with pagetypes and their translated name
@return array | [
"Returns",
"a",
"sorted",
"array",
"suitable",
"for",
"a",
"dropdown",
"with",
"pagetypes",
"and",
"their",
"translated",
"name"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSMain.php#L1014-L1022 |
silverstripe/silverstripe-cms | code/Controllers/CMSMain.php | CMSMain.getBreadcrumbsBackLink | public function getBreadcrumbsBackLink()
{
$breadcrumbs = $this->Breadcrumbs();
if ($breadcrumbs->count() < 2) {
return $this->LinkPages();
}
// Get second from end breadcrumb
return $breadcrumbs
->offsetGet($breadcrumbs->count() - 2)
->Lin... | php | public function getBreadcrumbsBackLink()
{
$breadcrumbs = $this->Breadcrumbs();
if ($breadcrumbs->count() < 2) {
return $this->LinkPages();
}
// Get second from end breadcrumb
return $breadcrumbs
->offsetGet($breadcrumbs->count() - 2)
->Lin... | [
"public",
"function",
"getBreadcrumbsBackLink",
"(",
")",
"{",
"$",
"breadcrumbs",
"=",
"$",
"this",
"->",
"Breadcrumbs",
"(",
")",
";",
"if",
"(",
"$",
"breadcrumbs",
"->",
"count",
"(",
")",
"<",
"2",
")",
"{",
"return",
"$",
"this",
"->",
"LinkPages... | Get "back" url for breadcrumbs
@return string | [
"Get",
"back",
"url",
"for",
"breadcrumbs"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSMain.php#L1034-L1044 |
silverstripe/silverstripe-cms | code/Controllers/CMSMain.php | CMSMain.SiteTreeHints | public function SiteTreeHints()
{
$classes = SiteTree::page_type_classes();
$memberID = Security::getCurrentUser() ? Security::getCurrentUser()->ID : 0;
$cache = $this->getHintsCache();
$cacheKey = $this->generateHintsCacheKey($memberID);
$json = $cache->get($cacheKey);
... | php | public function SiteTreeHints()
{
$classes = SiteTree::page_type_classes();
$memberID = Security::getCurrentUser() ? Security::getCurrentUser()->ID : 0;
$cache = $this->getHintsCache();
$cacheKey = $this->generateHintsCacheKey($memberID);
$json = $cache->get($cacheKey);
... | [
"public",
"function",
"SiteTreeHints",
"(",
")",
"{",
"$",
"classes",
"=",
"SiteTree",
"::",
"page_type_classes",
"(",
")",
";",
"$",
"memberID",
"=",
"Security",
"::",
"getCurrentUser",
"(",
")",
"?",
"Security",
"::",
"getCurrentUser",
"(",
")",
"->",
"I... | Create serialized JSON string with site tree hints data to be injected into
'data-hints' attribute of root node of jsTree.
@return string Serialized JSON | [
"Create",
"serialized",
"JSON",
"string",
"with",
"site",
"tree",
"hints",
"data",
"to",
"be",
"injected",
"into",
"data",
"-",
"hints",
"attribute",
"of",
"root",
"node",
"of",
"jsTree",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSMain.php#L1108-L1173 |
silverstripe/silverstripe-cms | code/Controllers/CMSMain.php | CMSMain.PageTypes | public function PageTypes()
{
$classes = SiteTree::page_type_classes();
$result = new ArrayList();
foreach ($classes as $class) {
$instance = SiteTree::singleton($class);
if ($instance instanceof HiddenClass) {
continue;
}
//... | php | public function PageTypes()
{
$classes = SiteTree::page_type_classes();
$result = new ArrayList();
foreach ($classes as $class) {
$instance = SiteTree::singleton($class);
if ($instance instanceof HiddenClass) {
continue;
}
//... | [
"public",
"function",
"PageTypes",
"(",
")",
"{",
"$",
"classes",
"=",
"SiteTree",
"::",
"page_type_classes",
"(",
")",
";",
"$",
"result",
"=",
"new",
"ArrayList",
"(",
")",
";",
"foreach",
"(",
"$",
"classes",
"as",
"$",
"class",
")",
"{",
"$",
"in... | Populates an array of classes in the CMS
which allows the user to change the page type.
@return SS_List | [
"Populates",
"an",
"array",
"of",
"classes",
"in",
"the",
"CMS",
"which",
"allows",
"the",
"user",
"to",
"change",
"the",
"page",
"type",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSMain.php#L1181-L1211 |
silverstripe/silverstripe-cms | code/Controllers/CMSMain.php | CMSMain.getRecord | public function getRecord($id, $versionID = null)
{
if (!$id) {
return null;
}
$treeClass = $this->config()->get('tree_class');
if ($id instanceof $treeClass) {
return $id;
}
if (substr($id, 0, 3) == 'new') {
return $this->getNewIte... | php | public function getRecord($id, $versionID = null)
{
if (!$id) {
return null;
}
$treeClass = $this->config()->get('tree_class');
if ($id instanceof $treeClass) {
return $id;
}
if (substr($id, 0, 3) == 'new') {
return $this->getNewIte... | [
"public",
"function",
"getRecord",
"(",
"$",
"id",
",",
"$",
"versionID",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"id",
")",
"{",
"return",
"null",
";",
"}",
"$",
"treeClass",
"=",
"$",
"this",
"->",
"config",
"(",
")",
"->",
"get",
"(",
"'... | Get a database record to be managed by the CMS.
@param int $id Record ID
@param int $versionID optional Version id of the given record
@return SiteTree | [
"Get",
"a",
"database",
"record",
"to",
"be",
"managed",
"by",
"the",
"CMS",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSMain.php#L1220-L1267 |
silverstripe/silverstripe-cms | code/Controllers/CMSMain.php | CMSMain.EditForm | public function EditForm($request = null)
{
// set page ID from request
if ($request) {
// Validate id is present
$id = $request->param('ID');
if (!isset($id)) {
$this->httpError(400);
return null;
}
$this->s... | php | public function EditForm($request = null)
{
// set page ID from request
if ($request) {
// Validate id is present
$id = $request->param('ID');
if (!isset($id)) {
$this->httpError(400);
return null;
}
$this->s... | [
"public",
"function",
"EditForm",
"(",
"$",
"request",
"=",
"null",
")",
"{",
"// set page ID from request",
"if",
"(",
"$",
"request",
")",
"{",
"// Validate id is present",
"$",
"id",
"=",
"$",
"request",
"->",
"param",
"(",
"'ID'",
")",
";",
"if",
"(",
... | {@inheritdoc}
@param HTTPRequest $request
@return Form | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSMain.php#L1275-L1288 |
silverstripe/silverstripe-cms | code/Controllers/CMSMain.php | CMSMain.getArchiveWarningMessage | protected function getArchiveWarningMessage($record)
{
$defaultMessage = _t('SilverStripe\\CMS\\Controllers\\CMSMain.ArchiveWarningWithChildren', 'Warning: This page and all of its child pages will be unpublished before being sent to the archive.\n\nAre you sure you want to proceed?');
// Option t... | php | protected function getArchiveWarningMessage($record)
{
$defaultMessage = _t('SilverStripe\\CMS\\Controllers\\CMSMain.ArchiveWarningWithChildren', 'Warning: This page and all of its child pages will be unpublished before being sent to the archive.\n\nAre you sure you want to proceed?');
// Option t... | [
"protected",
"function",
"getArchiveWarningMessage",
"(",
"$",
"record",
")",
"{",
"$",
"defaultMessage",
"=",
"_t",
"(",
"'SilverStripe\\\\CMS\\\\Controllers\\\\CMSMain.ArchiveWarningWithChildren'",
",",
"'Warning: This page and all of its child pages will be unpublished before being ... | Build an archive warning message based on the page's children
@param SiteTree $record
@return string | [
"Build",
"an",
"archive",
"warning",
"message",
"based",
"on",
"the",
"page",
"s",
"children"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSMain.php#L1436-L1484 |
silverstripe/silverstripe-cms | code/Controllers/CMSMain.php | CMSMain.collateDescendants | protected function collateDescendants($recordIDs, &$collator)
{
$children = SiteTree::get()->filter(['ParentID' => $recordIDs])->column();
if ($children) {
foreach ($children as $item) {
$collator[] = $item;
}
$this->collateDescendants($children, ... | php | protected function collateDescendants($recordIDs, &$collator)
{
$children = SiteTree::get()->filter(['ParentID' => $recordIDs])->column();
if ($children) {
foreach ($children as $item) {
$collator[] = $item;
}
$this->collateDescendants($children, ... | [
"protected",
"function",
"collateDescendants",
"(",
"$",
"recordIDs",
",",
"&",
"$",
"collator",
")",
"{",
"$",
"children",
"=",
"SiteTree",
"::",
"get",
"(",
")",
"->",
"filter",
"(",
"[",
"'ParentID'",
"=>",
"$",
"recordIDs",
"]",
")",
"->",
"column",
... | Find IDs of all descendant pages for the provided ID lists.
@param int[] $recordIDs
@param array $collator
@return bool | [
"Find",
"IDs",
"of",
"all",
"descendant",
"pages",
"for",
"the",
"provided",
"ID",
"lists",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSMain.php#L1492-L1504 |
silverstripe/silverstripe-cms | code/Controllers/CMSMain.php | CMSMain.childfilter | public function childfilter($request)
{
// Check valid parent specified
$parentID = $request->requestVar('ParentID');
$parent = SiteTree::get()->byID($parentID);
if (!$parent || !$parent->exists()) {
return $this->httpError(404);
}
// Build hints specific... | php | public function childfilter($request)
{
// Check valid parent specified
$parentID = $request->requestVar('ParentID');
$parent = SiteTree::get()->byID($parentID);
if (!$parent || !$parent->exists()) {
return $this->httpError(404);
}
// Build hints specific... | [
"public",
"function",
"childfilter",
"(",
"$",
"request",
")",
"{",
"// Check valid parent specified",
"$",
"parentID",
"=",
"$",
"request",
"->",
"requestVar",
"(",
"'ParentID'",
")",
";",
"$",
"parent",
"=",
"SiteTree",
"::",
"get",
"(",
")",
"->",
"byID",... | Callback to request the list of page types allowed under a given page instance.
Provides a slower but more precise response over SiteTreeHints
@param HTTPRequest $request
@return HTTPResponse | [
"Callback",
"to",
"request",
"the",
"list",
"of",
"page",
"types",
"allowed",
"under",
"a",
"given",
"page",
"instance",
".",
"Provides",
"a",
"slower",
"but",
"more",
"precise",
"response",
"over",
"SiteTreeHints"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSMain.php#L1553-L1582 |
silverstripe/silverstripe-cms | code/Controllers/CMSMain.php | CMSMain.getQueryFilter | protected function getQueryFilter($params)
{
if (empty($params['FilterClass'])) {
return null;
}
$filterClass = $params['FilterClass'];
if (!is_subclass_of($filterClass, CMSSiteTreeFilter::class)) {
throw new InvalidArgumentException("Invalid filter class pass... | php | protected function getQueryFilter($params)
{
if (empty($params['FilterClass'])) {
return null;
}
$filterClass = $params['FilterClass'];
if (!is_subclass_of($filterClass, CMSSiteTreeFilter::class)) {
throw new InvalidArgumentException("Invalid filter class pass... | [
"protected",
"function",
"getQueryFilter",
"(",
"$",
"params",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"params",
"[",
"'FilterClass'",
"]",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"filterClass",
"=",
"$",
"params",
"[",
"'FilterClass'",
"]",
";... | Safely reconstruct a selected filter from a given set of query parameters
@param array $params Query parameters to use, or null if none present
@return CMSSiteTreeFilter The filter class
@throws InvalidArgumentException if invalid filter class is passed. | [
"Safely",
"reconstruct",
"a",
"selected",
"filter",
"from",
"a",
"given",
"set",
"of",
"query",
"parameters"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSMain.php#L1591-L1601 |
silverstripe/silverstripe-cms | code/Controllers/CMSMain.php | CMSMain.getList | public function getList($params = array(), $parentID = 0)
{
if ($filter = $this->getQueryFilter($params)) {
return $filter->getFilteredPages();
} else {
$list = DataList::create($this->config()->get('tree_class'));
$parentID = is_numeric($parentID) ? $parentID : 0... | php | public function getList($params = array(), $parentID = 0)
{
if ($filter = $this->getQueryFilter($params)) {
return $filter->getFilteredPages();
} else {
$list = DataList::create($this->config()->get('tree_class'));
$parentID = is_numeric($parentID) ? $parentID : 0... | [
"public",
"function",
"getList",
"(",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"parentID",
"=",
"0",
")",
"{",
"if",
"(",
"$",
"filter",
"=",
"$",
"this",
"->",
"getQueryFilter",
"(",
"$",
"params",
")",
")",
"{",
"return",
"$",
"filter",
... | Returns the pages meet a certain criteria as {@see CMSSiteTreeFilter} or the subpages of a parent page
defaulting to no filter and show all pages in first level.
Doubles as search results, if any search parameters are set through {@link SearchForm()}.
@param array $params Search filter criteria
@param int $parentID Op... | [
"Returns",
"the",
"pages",
"meet",
"a",
"certain",
"criteria",
"as",
"{",
"@see",
"CMSSiteTreeFilter",
"}",
"or",
"the",
"subpages",
"of",
"a",
"parent",
"page",
"defaulting",
"to",
"no",
"filter",
"and",
"show",
"all",
"pages",
"in",
"first",
"level",
"."... | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSMain.php#L1613-L1622 |
silverstripe/silverstripe-cms | code/Controllers/CMSMain.php | CMSMain.save | public function save($data, $form)
{
$className = $this->config()->get('tree_class');
// Existing or new record?
$id = $data['ID'];
if (substr($id, 0, 3) != 'new') {
/** @var SiteTree $record */
$record = DataObject::get_by_id($className, $id);
//... | php | public function save($data, $form)
{
$className = $this->config()->get('tree_class');
// Existing or new record?
$id = $data['ID'];
if (substr($id, 0, 3) != 'new') {
/** @var SiteTree $record */
$record = DataObject::get_by_id($className, $id);
//... | [
"public",
"function",
"save",
"(",
"$",
"data",
",",
"$",
"form",
")",
"{",
"$",
"className",
"=",
"$",
"this",
"->",
"config",
"(",
")",
"->",
"get",
"(",
"'tree_class'",
")",
";",
"// Existing or new record?",
"$",
"id",
"=",
"$",
"data",
"[",
"'ID... | Save and Publish page handler
@param array $data
@param Form $form
@return HTTPResponse
@throws HTTPResponse_Exception | [
"Save",
"and",
"Publish",
"page",
"handler"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSMain.php#L1754-L1820 |
silverstripe/silverstripe-cms | code/Controllers/CMSMain.php | CMSMain.getNewItem | public function getNewItem($id, $setID = true)
{
$parentClass = $this->config()->get('tree_class');
list(, $className, $parentID) = array_pad(explode('-', $id), 3, null);
if (!is_a($className, $parentClass, true)) {
$response = Security::permissionFailure($this);
if ... | php | public function getNewItem($id, $setID = true)
{
$parentClass = $this->config()->get('tree_class');
list(, $className, $parentID) = array_pad(explode('-', $id), 3, null);
if (!is_a($className, $parentClass, true)) {
$response = Security::permissionFailure($this);
if ... | [
"public",
"function",
"getNewItem",
"(",
"$",
"id",
",",
"$",
"setID",
"=",
"true",
")",
"{",
"$",
"parentClass",
"=",
"$",
"this",
"->",
"config",
"(",
")",
"->",
"get",
"(",
"'tree_class'",
")",
";",
"list",
"(",
",",
"$",
"className",
",",
"$",
... | @uses LeftAndMainExtension->augmentNewSiteTreeItem()
@param int|string $id
@param bool $setID
@return mixed|DataObject
@throws HTTPResponse_Exception | [
"@uses",
"LeftAndMainExtension",
"-",
">",
"augmentNewSiteTreeItem",
"()"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSMain.php#L1830-L1872 |
silverstripe/silverstripe-cms | code/Controllers/CMSMain.php | CMSMain.performPublish | public function performPublish($record)
{
if ($record && !$record->canPublish()) {
return Security::permissionFailure($this);
}
$record->publishRecursive();
} | php | public function performPublish($record)
{
if ($record && !$record->canPublish()) {
return Security::permissionFailure($this);
}
$record->publishRecursive();
} | [
"public",
"function",
"performPublish",
"(",
"$",
"record",
")",
"{",
"if",
"(",
"$",
"record",
"&&",
"!",
"$",
"record",
"->",
"canPublish",
"(",
")",
")",
"{",
"return",
"Security",
"::",
"permissionFailure",
"(",
"$",
"this",
")",
";",
"}",
"$",
"... | Actually perform the publication step
@param Versioned|DataObject $record
@return mixed | [
"Actually",
"perform",
"the",
"publication",
"step"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSMain.php#L1880-L1887 |
silverstripe/silverstripe-cms | code/Controllers/CMSMain.php | CMSMain.revert | public function revert($data, $form)
{
if (!isset($data['ID'])) {
throw new HTTPResponse_Exception("Please pass an ID in the form content", 400);
}
$id = (int) $data['ID'];
$restoredPage = Versioned::get_latest_version(SiteTree::class, $id);
if (!$restoredPage) {... | php | public function revert($data, $form)
{
if (!isset($data['ID'])) {
throw new HTTPResponse_Exception("Please pass an ID in the form content", 400);
}
$id = (int) $data['ID'];
$restoredPage = Versioned::get_latest_version(SiteTree::class, $id);
if (!$restoredPage) {... | [
"public",
"function",
"revert",
"(",
"$",
"data",
",",
"$",
"form",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"data",
"[",
"'ID'",
"]",
")",
")",
"{",
"throw",
"new",
"HTTPResponse_Exception",
"(",
"\"Please pass an ID in the form content\"",
",",
"400"... | Reverts a page by publishing it to live.
Use {@link restorepage()} if you want to restore a page
which was deleted from draft without publishing.
@uses SiteTree->doRevertToLive()
@param array $data
@param Form $form
@return HTTPResponse
@throws HTTPResponse_Exception | [
"Reverts",
"a",
"page",
"by",
"publishing",
"it",
"to",
"live",
".",
"Use",
"{",
"@link",
"restorepage",
"()",
"}",
"if",
"you",
"want",
"to",
"restore",
"a",
"page",
"which",
"was",
"deleted",
"from",
"draft",
"without",
"publishing",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSMain.php#L1901-L1940 |
silverstripe/silverstripe-cms | code/Controllers/CMSMain.php | CMSMain.delete | public function delete($data, $form)
{
$id = $data['ID'];
$record = SiteTree::get()->byID($id);
if ($record && !$record->canDelete()) {
return Security::permissionFailure();
}
if (!$record || !$record->ID) {
throw new HTTPResponse_Exception("Bad record... | php | public function delete($data, $form)
{
$id = $data['ID'];
$record = SiteTree::get()->byID($id);
if ($record && !$record->canDelete()) {
return Security::permissionFailure();
}
if (!$record || !$record->ID) {
throw new HTTPResponse_Exception("Bad record... | [
"public",
"function",
"delete",
"(",
"$",
"data",
",",
"$",
"form",
")",
"{",
"$",
"id",
"=",
"$",
"data",
"[",
"'ID'",
"]",
";",
"$",
"record",
"=",
"SiteTree",
"::",
"get",
"(",
")",
"->",
"byID",
"(",
"$",
"id",
")",
";",
"if",
"(",
"$",
... | Delete the current page from draft stage.
@see deletefromlive()
@param array $data
@param Form $form
@return HTTPResponse
@throws HTTPResponse_Exception | [
"Delete",
"the",
"current",
"page",
"from",
"draft",
"stage",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSMain.php#L1952-L1977 |
silverstripe/silverstripe-cms | code/Controllers/CMSMain.php | CMSMain.archive | public function archive($data, $form)
{
$id = $data['ID'];
/** @var SiteTree $record */
$record = SiteTree::get()->byID($id);
if (!$record || !$record->exists()) {
throw new HTTPResponse_Exception("Bad record ID #$id", 404);
}
if (!$record->canArchive()) {... | php | public function archive($data, $form)
{
$id = $data['ID'];
/** @var SiteTree $record */
$record = SiteTree::get()->byID($id);
if (!$record || !$record->exists()) {
throw new HTTPResponse_Exception("Bad record ID #$id", 404);
}
if (!$record->canArchive()) {... | [
"public",
"function",
"archive",
"(",
"$",
"data",
",",
"$",
"form",
")",
"{",
"$",
"id",
"=",
"$",
"data",
"[",
"'ID'",
"]",
";",
"/** @var SiteTree $record */",
"$",
"record",
"=",
"SiteTree",
"::",
"get",
"(",
")",
"->",
"byID",
"(",
"$",
"id",
... | Delete this page from both live and stage
@param array $data
@param Form $form
@return HTTPResponse
@throws HTTPResponse_Exception | [
"Delete",
"this",
"page",
"from",
"both",
"live",
"and",
"stage"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSMain.php#L1987-L2013 |
silverstripe/silverstripe-cms | code/Controllers/CMSMain.php | CMSMain.doRollback | public function doRollback($data, $form)
{
$this->extend('onBeforeRollback', $data['ID'], $data['Version']);
$id = (isset($data['ID'])) ? (int) $data['ID'] : null;
$version = (isset($data['Version'])) ? (int) $data['Version'] : null;
/** @var DataObject|Versioned $record */
... | php | public function doRollback($data, $form)
{
$this->extend('onBeforeRollback', $data['ID'], $data['Version']);
$id = (isset($data['ID'])) ? (int) $data['ID'] : null;
$version = (isset($data['Version'])) ? (int) $data['Version'] : null;
/** @var DataObject|Versioned $record */
... | [
"public",
"function",
"doRollback",
"(",
"$",
"data",
",",
"$",
"form",
")",
"{",
"$",
"this",
"->",
"extend",
"(",
"'onBeforeRollback'",
",",
"$",
"data",
"[",
"'ID'",
"]",
",",
"$",
"data",
"[",
"'Version'",
"]",
")",
";",
"$",
"id",
"=",
"(",
... | Rolls a site back to a given version ID
@param array $data
@param Form $form
@return HTTPResponse | [
"Rolls",
"a",
"site",
"back",
"to",
"a",
"given",
"version",
"ID"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSMain.php#L2067-L2107 |
silverstripe/silverstripe-cms | code/Controllers/CMSMain.php | CMSMain.restore | public function restore($data, $form)
{
if (!isset($data['ID']) || !is_numeric($data['ID'])) {
return new HTTPResponse("Please pass an ID in the form content", 400);
}
$id = (int)$data['ID'];
/** @var SiteTree $restoredPage */
$restoredPage = Versioned::get_lates... | php | public function restore($data, $form)
{
if (!isset($data['ID']) || !is_numeric($data['ID'])) {
return new HTTPResponse("Please pass an ID in the form content", 400);
}
$id = (int)$data['ID'];
/** @var SiteTree $restoredPage */
$restoredPage = Versioned::get_lates... | [
"public",
"function",
"restore",
"(",
"$",
"data",
",",
"$",
"form",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"data",
"[",
"'ID'",
"]",
")",
"||",
"!",
"is_numeric",
"(",
"$",
"data",
"[",
"'ID'",
"]",
")",
")",
"{",
"return",
"new",
"HTTPR... | Restore a completely deleted page from the SiteTree_versions table.
@param array $data
@param Form $form
@return HTTPResponse | [
"Restore",
"a",
"completely",
"deleted",
"page",
"from",
"the",
"SiteTree_versions",
"table",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSMain.php#L2226-L2251 |
silverstripe/silverstripe-cms | code/Controllers/CMSMain.php | CMSMain.flushMemberCache | public function flushMemberCache($memberIDs = null)
{
$cache = $this->getHintsCache();
if (!$memberIDs) {
$cache->clear();
return;
}
foreach ($memberIDs as $memberID) {
$key = $this->generateHintsCacheKey($memberID);
$cache->delete($k... | php | public function flushMemberCache($memberIDs = null)
{
$cache = $this->getHintsCache();
if (!$memberIDs) {
$cache->clear();
return;
}
foreach ($memberIDs as $memberID) {
$key = $this->generateHintsCacheKey($memberID);
$cache->delete($k... | [
"public",
"function",
"flushMemberCache",
"(",
"$",
"memberIDs",
"=",
"null",
")",
"{",
"$",
"cache",
"=",
"$",
"this",
"->",
"getHintsCache",
"(",
")",
";",
"if",
"(",
"!",
"$",
"memberIDs",
")",
"{",
"$",
"cache",
"->",
"clear",
"(",
")",
";",
"r... | Flush the hints cache for a specific member
@param array $memberIDs | [
"Flush",
"the",
"hints",
"cache",
"for",
"a",
"specific",
"member"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSMain.php#L2385-L2398 |
silverstripe/silverstripe-cms | code/Search/SearchForm.php | SearchForm.classesToSearch | public function classesToSearch($classes)
{
$supportedClasses = array(SiteTree::class, File::class);
$illegalClasses = array_diff($classes, $supportedClasses);
if ($illegalClasses) {
throw new BadMethodCallException(
"SearchForm::classesToSearch() passed illegal c... | php | public function classesToSearch($classes)
{
$supportedClasses = array(SiteTree::class, File::class);
$illegalClasses = array_diff($classes, $supportedClasses);
if ($illegalClasses) {
throw new BadMethodCallException(
"SearchForm::classesToSearch() passed illegal c... | [
"public",
"function",
"classesToSearch",
"(",
"$",
"classes",
")",
"{",
"$",
"supportedClasses",
"=",
"array",
"(",
"SiteTree",
"::",
"class",
",",
"File",
"::",
"class",
")",
";",
"$",
"illegalClasses",
"=",
"array_diff",
"(",
"$",
"classes",
",",
"$",
... | Set the classes to search.
Currently you can only choose from "SiteTree" and "File", but a future version might improve this.
@param array $classes | [
"Set",
"the",
"classes",
"to",
"search",
".",
"Currently",
"you",
"can",
"only",
"choose",
"from",
"SiteTree",
"and",
"File",
"but",
"a",
"future",
"version",
"might",
"improve",
"this",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Search/SearchForm.php#L98-L110 |
silverstripe/silverstripe-cms | code/Search/SearchForm.php | SearchForm.getResults | public function getResults()
{
// Get request data from request handler
$request = $this->getRequestHandler()->getRequest();
// set language (if present)
$locale = null;
$origLocale = null;
if (class_exists('Translatable')) {
$locale = $request->requestVa... | php | public function getResults()
{
// Get request data from request handler
$request = $this->getRequestHandler()->getRequest();
// set language (if present)
$locale = null;
$origLocale = null;
if (class_exists('Translatable')) {
$locale = $request->requestVa... | [
"public",
"function",
"getResults",
"(",
")",
"{",
"// Get request data from request handler",
"$",
"request",
"=",
"$",
"this",
"->",
"getRequestHandler",
"(",
")",
"->",
"getRequest",
"(",
")",
";",
"// set language (if present)",
"$",
"locale",
"=",
"null",
";"... | Return dataObjectSet of the results using current request to get info from form.
Wraps around {@link searchEngine()}.
@return SS_List | [
"Return",
"dataObjectSet",
"of",
"the",
"results",
"using",
"current",
"request",
"to",
"get",
"info",
"from",
"form",
".",
"Wraps",
"around",
"{",
"@link",
"searchEngine",
"()",
"}",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Search/SearchForm.php#L128-L196 |
silverstripe/silverstripe-cms | code/Controllers/ContentController.php | ContentController.ChildrenOf | public function ChildrenOf($parentRef)
{
$parent = SiteTree::get_by_link($parentRef);
if (!$parent && is_numeric($parentRef)) {
$parent = DataObject::get_by_id(SiteTree::class, $parentRef);
}
if ($parent) {
return $parent->Children();
}
retur... | php | public function ChildrenOf($parentRef)
{
$parent = SiteTree::get_by_link($parentRef);
if (!$parent && is_numeric($parentRef)) {
$parent = DataObject::get_by_id(SiteTree::class, $parentRef);
}
if ($parent) {
return $parent->Children();
}
retur... | [
"public",
"function",
"ChildrenOf",
"(",
"$",
"parentRef",
")",
"{",
"$",
"parent",
"=",
"SiteTree",
"::",
"get_by_link",
"(",
"$",
"parentRef",
")",
";",
"if",
"(",
"!",
"$",
"parent",
"&&",
"is_numeric",
"(",
"$",
"parentRef",
")",
")",
"{",
"$",
"... | Return the children of a given page. The parent reference can either be a page link or an ID.
@param string|int $parentRef
@return SS_List | [
"Return",
"the",
"children",
"of",
"a",
"given",
"page",
".",
"The",
"parent",
"reference",
"can",
"either",
"be",
"a",
"page",
"link",
"or",
"an",
"ID",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/ContentController.php#L115-L127 |
silverstripe/silverstripe-cms | code/Controllers/ContentController.php | ContentController.handleRequest | public function handleRequest(HTTPRequest $request)
{
/** @var SiteTree $child */
$child = null;
$action = $request->param('Action');
// If nested URLs are enabled, and there is no action handler for the current request then attempt to pass
// control to a child controller. ... | php | public function handleRequest(HTTPRequest $request)
{
/** @var SiteTree $child */
$child = null;
$action = $request->param('Action');
// If nested URLs are enabled, and there is no action handler for the current request then attempt to pass
// control to a child controller. ... | [
"public",
"function",
"handleRequest",
"(",
"HTTPRequest",
"$",
"request",
")",
"{",
"/** @var SiteTree $child */",
"$",
"child",
"=",
"null",
";",
"$",
"action",
"=",
"$",
"request",
"->",
"param",
"(",
"'Action'",
")",
";",
"// If nested URLs are enabled, and th... | This acts the same as {@link Controller::handleRequest()}, but if an action cannot be found this will attempt to
fall over to a child controller in order to provide functionality for nested URLs.
@param HTTPRequest $request
@return HTTPResponse
@throws HTTPResponse_Exception | [
"This",
"acts",
"the",
"same",
"as",
"{",
"@link",
"Controller",
"::",
"handleRequest",
"()",
"}",
"but",
"if",
"an",
"action",
"cannot",
"be",
"found",
"this",
"will",
"attempt",
"to",
"fall",
"over",
"to",
"a",
"child",
"controller",
"in",
"order",
"to... | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/ContentController.php#L185-L256 |
silverstripe/silverstripe-cms | code/Controllers/ContentController.php | ContentController.getMenu | public function getMenu($level = 1)
{
if ($level == 1) {
$result = SiteTree::get()->filter([
"ShowInMenus" => 1,
"ParentID" => 0,
]);
} else {
$parent = $this->data();
$stack = [$parent];
if ($parent) {
... | php | public function getMenu($level = 1)
{
if ($level == 1) {
$result = SiteTree::get()->filter([
"ShowInMenus" => 1,
"ParentID" => 0,
]);
} else {
$parent = $this->data();
$stack = [$parent];
if ($parent) {
... | [
"public",
"function",
"getMenu",
"(",
"$",
"level",
"=",
"1",
")",
"{",
"if",
"(",
"$",
"level",
"==",
"1",
")",
"{",
"$",
"result",
"=",
"SiteTree",
"::",
"get",
"(",
")",
"->",
"filter",
"(",
"[",
"\"ShowInMenus\"",
"=>",
"1",
",",
"\"ParentID\""... | Returns a fixed navigation menu of the given level.
@param int $level Menu level to return.
@return ArrayList | [
"Returns",
"a",
"fixed",
"navigation",
"menu",
"of",
"the",
"given",
"level",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/ContentController.php#L283-L319 |
silverstripe/silverstripe-cms | code/Controllers/ContentController.php | ContentController.ContentLocale | public function ContentLocale()
{
if ($this->dataRecord && $this->dataRecord->hasExtension('Translatable')) {
$locale = $this->dataRecord->Locale;
} elseif (class_exists('Translatable') && SiteTree::has_extension('Translatable')) {
$locale = Translatable::get_current_locale()... | php | public function ContentLocale()
{
if ($this->dataRecord && $this->dataRecord->hasExtension('Translatable')) {
$locale = $this->dataRecord->Locale;
} elseif (class_exists('Translatable') && SiteTree::has_extension('Translatable')) {
$locale = Translatable::get_current_locale()... | [
"public",
"function",
"ContentLocale",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"dataRecord",
"&&",
"$",
"this",
"->",
"dataRecord",
"->",
"hasExtension",
"(",
"'Translatable'",
")",
")",
"{",
"$",
"locale",
"=",
"$",
"this",
"->",
"dataRecord",
"->"... | Returns an RFC1766 compliant locale string, e.g. 'fr-CA'.
Inspects the associated {@link dataRecord} for a {@link SiteTree->Locale} value if present,
and falls back to {@link Translatable::get_current_locale()} or {@link i18n::default_locale()},
depending if Translatable is enabled.
Suitable for insertion into lang= a... | [
"Returns",
"an",
"RFC1766",
"compliant",
"locale",
"string",
"e",
".",
"g",
".",
"fr",
"-",
"CA",
".",
"Inspects",
"the",
"associated",
"{",
"@link",
"dataRecord",
"}",
"for",
"a",
"{",
"@link",
"SiteTree",
"-",
">",
"Locale",
"}",
"value",
"if",
"pres... | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/ContentController.php#L420-L431 |
silverstripe/silverstripe-cms | code/Controllers/ContentController.php | ContentController.getViewer | public function getViewer($action)
{
// Manually set templates should be dealt with by Controller::getViewer()
if (!empty($this->templates[$action])
|| !empty($this->templates['index'])
|| $this->template
) {
return parent::getViewer($action);
}
... | php | public function getViewer($action)
{
// Manually set templates should be dealt with by Controller::getViewer()
if (!empty($this->templates[$action])
|| !empty($this->templates['index'])
|| $this->template
) {
return parent::getViewer($action);
}
... | [
"public",
"function",
"getViewer",
"(",
"$",
"action",
")",
"{",
"// Manually set templates should be dealt with by Controller::getViewer()",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"templates",
"[",
"$",
"action",
"]",
")",
"||",
"!",
"empty",
"(",
"$"... | Return an SSViewer object to render the template for the current page.
@param $action string
@return SSViewer | [
"Return",
"an",
"SSViewer",
"object",
"to",
"render",
"the",
"template",
"for",
"the",
"current",
"page",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/ContentController.php#L441-L473 |
silverstripe/silverstripe-cms | code/Controllers/ContentController.php | ContentController.successfullyinstalled | public function successfullyinstalled()
{
// Return 410 Gone if this site is not actually a fresh installation
if (!file_exists(PUBLIC_PATH . '/install.php')) {
$this->httpError(410);
}
// TODO Allow this to work when allow_url_fopen=0
if (isset($_SESSION['StatsI... | php | public function successfullyinstalled()
{
// Return 410 Gone if this site is not actually a fresh installation
if (!file_exists(PUBLIC_PATH . '/install.php')) {
$this->httpError(410);
}
// TODO Allow this to work when allow_url_fopen=0
if (isset($_SESSION['StatsI... | [
"public",
"function",
"successfullyinstalled",
"(",
")",
"{",
"// Return 410 Gone if this site is not actually a fresh installation",
"if",
"(",
"!",
"file_exists",
"(",
"PUBLIC_PATH",
".",
"'/install.php'",
")",
")",
"{",
"$",
"this",
"->",
"httpError",
"(",
"410",
"... | This action is called by the installation system | [
"This",
"action",
"is",
"called",
"by",
"the",
"installation",
"system"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/ContentController.php#L479-L506 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.