Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ProcessWire API Visual Studio Code Snippets
{
"pages->find(\"selector\")": {
"prefix": "pages find(\"selector\")",
"body": [
"\\$${1:pages}->find(\"${2:selector}\");"
],
"description": "Find and return all pages matching the given selector string. Returns a filtered PageArray unless an include mode is specified."
},
"pages->count(\"selector\")": {
"prefix": "pages count(\"selector\")",
"body": [
"\\$${1:pages}->count(\"${2:selector}\");"
],
"description": "Count pages matching the selector. Returned count is filtered unless an include mode is specified."
},
"pages->get(\"selector\")": {
"prefix": "pages get(\"selector\")",
"body": [
"\\$${1:pages}->get(\"${2:selector}\");"
],
"description": "Get the page matching the given selector string without exclusions. Returns a Page, or a NullPage if not found."
},
"pages->get(123)": {
"prefix": "pages get(123)",
"body": [
"\\$${1:pages}->get(${2:123});"
],
"description": "Get the page matching the given numeric ID, with no exclusions. Returns a Page, or a NullPage if not found."
},
"pages->get(\"/path/to/page/\")": {
"prefix": "pages get(\"/path/to/page/\")",
"body": [
"\\$${1:pages}->get(\"${2:/path/to/page/}\");"
],
"description": "Get the page matching the given path/URL (relative to ProcessWire installation root), with no exclusions. Returns a Page, or a NullPage if not found."
},
"pages->save($page)": {
"prefix": "pages save($page)",
"body": [
"\\$${1:pages}->save($${2:page});"
],
"description": "Save any changes made to the given $page. Same as: $page->save() with no arguments."
},
"pages->saveField($page, 'field')": {
"prefix": "pages saveField($page, 'field')",
"body": [
"\\$${1:pages}->saveField($${2:page}, \"${3:field}\");"
],
"description": "Save just the named field from $page. (v2.1+) Same as: $page->save('field')"
},
"pages->trash($page)": {
"prefix": "pages trash($page)",
"body": [
"\\$${1:pages}->trash($${2:page});"
],
"description": "Move the given page to the Trash."
},
"pages->delete($page)": {
"prefix": "pages delete($page)",
"body": [
"\\$${1:pages}->delete($${2:page});"
],
"description": "Permanently delete the given page and any attached media. Throws error when $page has children."
},
"pages->delete($page, true)": {
"prefix": "pages delete($page, true)",
"body": [
"\\$${1:pages}->delete($${2:page}, ${3:true});"
],
"description": "Recursively delete $page and all it's children and attached media, permanently."
},
"pages->clone($page)": {
"prefix": "pages clone($page)",
"body": [
"\\$${1:pages}->clone($${2:page});"
],
"description": "Creates a brand new cloned copy of the given page (and any children) and returns it. (v2.1+)"
},
"pages->clone($page, $parent)": {
"prefix": "pages clone($page, $parent)",
"body": [
"\\$${1:pages}->clone($${2:page}, $${3:parent});"
],
"description": "Like the above, but with a new $parent page specified. (v2.1+)"
},
"pages->clone($page, $parent, false)": {
"prefix": "pages clone($page, $parent, false)",
"body": [
"\\$${1:pages}->clone($${2:page}, $${3:parent}, ${4:false});"
],
"description": "Like the above, but only the given page will be cloned (and not any children). (v2.1+)"
},
"page->id": {
"prefix": "page id",
"body": [
"$${1:page}->id;"
],
"description": "The numbered ID of the current page"
},
"page->name": {
"prefix": "page name",
"body": [
"$${1:page}->name;"
],
"description": "The name assigned to the page, as it appears in the URL"
},
"page->title": {
"prefix": "page title",
"body": [
"$${1:page}->title;"
],
"description": "The page's title (headline) text"
},
"page->path": {
"prefix": "page path",
"body": [
"$${1:page}->path;"
],
"description": "The page's URL path from the homepage (i.e. /about/staff/ryan/)"
},
"page->url": {
"prefix": "page url",
"body": [
"$${1:page}->url;"
],
"description": "The page's URL path from the server's document root (may be the same as the $page->path)"
},
"page->httpUrl": {
"prefix": "page httpUrl",
"body": [
"$${1:page}->httpUrl;"
],
"description": "Same as $page->url, except includes protocol (http or https) and hostname."
},
"page->parent": {
"prefix": "page parent",
"body": [
"$${1:page}->parent;"
],
"description": "The parent Page object or a NullPage if there is no parent."
},
"page->parentID": {
"prefix": "page parentID",
"body": [
"$${1:page}->parentID;"
],
"description": "The numbered ID of the parent page or 0 if none. $page->parent_id also works."
},
"page->parents": {
"prefix": "page parents",
"body": [
"$${1:page}->parents;"
],
"description": "Return this page's parent pages as Page Array."
},
"page->rootParent": {
"prefix": "page rootParent",
"body": [
"$${1:page}->rootParent;"
],
"description": "The parent page closest to the homepage (typically used for identifying a section)"
},
"page->template": {
"prefix": "page template",
"body": [
"$${1:page}->template;"
],
"description": "The Template object this page is using"
},
"page->fields": {
"prefix": "page fields",
"body": [
"$${1:page}->fields;"
],
"description": "All the Fields assigned to this page (via it's template, same as $page->template->fields). Returns a FieldsArray."
},
"page->numChildren": {
"prefix": "page numChildren",
"body": [
"$${1:page}->numChildren;"
],
"description": "The number of children (subpages) this page has."
},
"page->children": {
"prefix": "page children",
"body": [
"$${1:page}->children;"
],
"description": "All the children (subpages) of this page.* Returns a filtered PageArray. See also $page->children($selector)."
},
"page->child": {
"prefix": "page child",
"body": [
"$${1:page}->child;"
],
"description": "The first child of this page. Returns a Page. See also $page->child($selector)."
},
"page->siblings": {
"prefix": "page siblings",
"body": [
"$${1:page}->siblings;"
],
"description": "All the sibling pages of this page.� Returns a PageArray. See also $page->siblings($selector)."
},
"page->next": {
"prefix": "page next",
"body": [
"$${1:page}->next;"
],
"description": "This page's next sibling page, or NullPage if it is the last sibling.� See also $page->next($pageArray)."
},
"page->prev": {
"prefix": "page prev",
"body": [
"$${1:page}->prev;"
],
"description": "This page's previous sibling page, or NullPage if it is the first sibling.� See also $page->prev($pageArray)."
},
"page->created": {
"prefix": "page created",
"body": [
"$${1:page}->created;"
],
"description": "Unix timestamp of when the page was created"
},
"page->modified": {
"prefix": "page modified",
"body": [
"$${1:page}->modified;"
],
"description": "Unix timestamp of when the page was last modified"
},
"page->createdUser": {
"prefix": "page createdUser",
"body": [
"$${1:page}->createdUser;"
],
"description": "The user that created this page. Returns a User or a NullUser."
},
"page->modifiedUser": {
"prefix": "page modifiedUser",
"body": [
"$${1:page}->modifiedUser;"
],
"description": "The user that last modified this page. Returns a User or a NullUser."
},
"page->find($selector)": {
"prefix": "page find($selector)",
"body": [
"\\$${1:page}->find($${2:selector});"
],
"description": "Find pages matching the selector anywhere below this page (children, grandchildren, etc.). Returns a PageArray."
},
"page->get(\"field\")": {
"prefix": "page get(\"field\")",
"body": [
"\\$${1:page}->get(\"${2:field}\");"
],
"description": "Get the value for the specified field or null if the field isn't part of this page. Same as $page->$field"
},
"page->get(\"field1|f2|f3\")": {
"prefix": "page get(\"field1|f2|f3\")",
"body": [
"\\$${1:page}->get(\"${2:field1|f2|f3}\");"
],
"description": "Get the first matching non-empty field by specified by a string of pipe \"|\" separated field names"
},
"page->getUnformatted(\"field\")": {
"prefix": "page getUnformatted(\"field\")",
"body": [
"\\$${1:page}->getUnformatted(\"${2:field}\");"
],
"description": "Get the unformatted value of the given field name. May also be used with \"|\" separated field names (mentioned above)."
},
"page->setOutputFormatting(true|false)": {
"prefix": "page setOutputFormatting(true|false)",
"body": [
"\\$${1:page}->setOutputFormatting(${2:true|false});"
],
"description": "By default, output will be formatted according filters you may have defined with the field. If you are modifying the values of a page's custom fields, you will need to call $page->setOutputFormatting(false) before doing so. This turns off output formatting, which ensures that saved values don't already have runtime formatters applied to them. ProcessWire will throw an error if you attempt to save formatted fields."
},
"page->of(true|false)": {
"prefix": "page of(true|false)",
"body": [
"\\$${1:page}->of(${2:true|false});"
],
"description": "This is the short notation of setOutputFormatting(). Since PW 2.2.2"
},
"page->numChildren(bool)": {
"prefix": "page numChildren(bool)",
"body": [
"\\$${1:page}->numChildren(${2:bool});"
],
"description": "Return number of children, optionally limiting to visible pages. When true, number includes only visible children (excludes unpublished, hidden, no-access, etc.)"
},
"page->children($selector)": {
"prefix": "page children($selector)",
"body": [
"\\$${1:page}->children($${2:selector});"
],
"description": "Returns the filtered children (PageArray) of this page, optionally filtered by a selector."
},
"page->child($selector)": {
"prefix": "page child($selector)",
"body": [
"\\$${1:page}->child($${2:selector});"
],
"description": "The first matching child (subpage) that matches the given selector. Returns a Page, or a NullPage if no match."
},
"page->siblings($selector)": {
"prefix": "page siblings($selector)",
"body": [
"\\$${1:page}->siblings($${2:selector});"
],
"description": "All the sibling pages of this page, filtered by a selector.� Returns a PageArray."
},
"page->parent($selector)": {
"prefix": "page parent($selector)",
"body": [
"\\$${1:page}->parent($${2:selector});"
],
"description": "Return this page's parent Page, or the closest parent matching the given selector."
},
"page->parents($selector)": {
"prefix": "page parents($selector)",
"body": [
"\\$${1:page}->parents($${2:selector});"
],
"description": "Return this page's parent pages, or the parent pages matching the given selector."
},
"page->parentsUntil($selector, $filter)": {
"prefix": "page parentsUntil($selector, $filter)",
"body": [
"\\$${1:page}->parentsUntil($${2:selector}, $${3:filter});"
],
"description": "Return all parents from current till the one matched by $selector. $selector May either be a selector string or Page to stop at. Results will not include this. $filter Optional selector string to filter matched pages by"
},
"page->closest($selector)": {
"prefix": "page closest($selector)",
"body": [
"\\$${1:page}->closest($${2:selector});"
],
"description": "Like parent() but includes the current Page in the possible pages that can be matched. Note also that unlike parent() a $selector is required."
},
"page->next($pageArray)": {
"prefix": "page next($pageArray)",
"body": [
"\\$${1:page}->next($${2:pageArray});"
],
"description": "Given a PageArray which includes the current page (among others), return the next page after the current.� Returns a NullPage if it is the last page in the provided PageArray. If called without a PageArray, it assumes the current page's siblings (same as $page->next)."
},
"page->nextAll($selector, $siblings)": {
"prefix": "page nextAll($selector, $siblings)",
"body": [
"\\$${1:page}->nextAll($${2:selector}, $${3:siblings});"
],
"description": "Return all sibling pages after this one, optionally matching a selector. $selector Optional selector string. When specified, will filter the found siblings. $siblings Optional siblings to use instead of the default."
},
"page->nextUntil($selector, $filter, $siblings)": {
"prefix": "page nextUntil($selector, $filter, $siblings)",
"body": [
"\\$${1:page}->nextUntil($${2:selector}, $${3:filter}, $${4:siblings});"
],
"description": "Return all sibling pages after this one until matching the one specified. $selector May either be a selector string or Page to stop at. Results will not include this. $filter Optional selector string to filter matched pages by. $siblings optional PageArray of siblings to use instead of all from the page."
},
"page->prev($pageArray)": {
"prefix": "page prev($pageArray)",
"body": [
"\\$${1:page}->prev($${2:pageArray});"
],
"description": "Given a PageArray which includes the current page (among others), return the previous page before the current.� Returns a NullPage if it is the first page in the provided PageArray. If called without a PageArray, it assumes the current page's siblings (same as $page->prev)."
},
"page->prevAll($selector, $siblings)": {
"prefix": "page prevAll($selector, $siblings)",
"body": [
"\\$${1:page}->prevAll($${2:selector}, $${3:siblings});"
],
"description": "Return all sibling pages before this one, optionally matching a selector. $selector Optional selector string. When specified, will filter the found siblings. $siblings Optional siblings to use instead of the default."
},
"page->prevUntil($selector, $filter, $siblings)": {
"prefix": "page prevUntil($selector, $filter, $siblings)",
"body": [
"\\$${1:page}->prevUntil($${2:selector}, $${3:filter}, $${4:siblings});"
],
"description": "Return all sibling pages before this one until matching the one specified. $selector May either be a selector string or Page to stop at. Results will not include this. $filter Optional selector string to filter matched pages by. $siblings Optional PageArray of siblings to use instead of all from the page."
},
"page->save()": {
"prefix": "page save()",
"body": [
"\\$${1:page}->save(${2:});"
],
"description": "Save this Page"
},
"page->save($field)": {
"prefix": "page save($field)",
"body": [
"\\$${1:page}->save($${2:field});"
],
"description": "Save just the field given by the provided field name (string) or object (Field)"
},
"page->delete()": {
"prefix": "page delete()",
"body": [
"\\$${1:page}->delete(${2:});"
],
"description": "Delete this page"
},
"page->is($name)": {
"prefix": "page is($name)",
"body": [
"\\$${1:page}->is($${2:name});"
],
"description": "Returns true if this page matches the given template name, page status, or selector."
},
"page->isChanged()": {
"prefix": "page isChanged()",
"body": [
"\\$${1:page}->isChanged(${2:});"
],
"description": "Has the $page changed since it was loaded? Returns true or false."
},
"page->isChanged(\"field\")": {
"prefix": "page isChanged(\"field\")",
"body": [
"\\$${1:page}->isChanged(\"${2:field}\");"
],
"description": "Has the given field on $page changed since it was loaded? Returns true or false."
},
"page->isNew()": {
"prefix": "page isNew()",
"body": [
"\\$${1:page}->isNew(${2:});"
],
"description": "Is this Page new? (i.e. doesn't yet exist in DB)"
},
"page->isHidden()": {
"prefix": "page isHidden()",
"body": [
"\\$${1:page}->isHidden(${2:});"
],
"description": "Returns true if page has status hidden."
},
"page->isTrash()": {
"prefix": "page isTrash()",
"body": [
"\\$${1:page}->isTrash(${2:});"
],
"description": "Returns true if page is in trash."
},
"page->matches(\"selector\")": {
"prefix": "page matches(\"selector\")",
"body": [
"\\$${1:page}->matches(\"${2:selector}\");"
],
"description": "Returns true if this page matches the given selector string."
},
"page->render()": {
"prefix": "page render()",
"body": [
"\\$${1:page}->render(${2:});"
],
"description": "Returns rendered page markup. echo $page->render();"
},
"page->set(\"field\", $value)": {
"prefix": "page set(\"field\", $value)",
"body": [
"\\$${1:page}->set(\"${2:field}\", $${3:value});"
],
"description": "Set the given custom field name to have the provided value. Same as $page->$field = $value;"
},
"page->editable()": {
"prefix": "page editable()",
"body": [
"\\$${1:page}->editable(${2:});"
],
"description": "Is the page is editable by the current user? Returns true or false."
},
"page->editable('field')": {
"prefix": "page editable('field')",
"body": [
"\\$${1:page}->editable(\"${2:field}\");"
],
"description": "Is the given field name is editable on the page by the current user? Returns true or false."
},
"page->viewable()": {
"prefix": "page viewable()",
"body": [
"\\$${1:page}->viewable(${2:});"
],
"description": "Is the page viewable by the current user? Returns true or false. Note that this is only useful on pages other than the current page being viewed, as ProcessWire won't let the user load a page (by URL) that they don't have access to view."
},
"page->addable()": {
"prefix": "page addable()",
"body": [
"\\$${1:page}->addable(${2:});"
],
"description": "Is the current user allowed to create pages below this page? Returns true or false."
},
"page->addable($addPage)": {
"prefix": "page addable($addPage)",
"body": [
"\\$${1:page}->addable($${2:addPage});"
],
"description": "Is the current user allowed to add the given page ($addPage) as a child of $page? Returns true or false."
},
"page->moveable()": {
"prefix": "page moveable()",
"body": [
"\\$${1:page}->moveable(${2:});"
],
"description": "Is the page allowed to be moved by the current user? Returns true or false."
},
"page->moveable($parent)": {
"prefix": "page moveable($parent)",
"body": [
"\\$${1:page}->moveable($${2:parent});"
],
"description": "Is the current user allowed to move $page to $parent? Returns true or false."
},
"page->sortable()": {
"prefix": "page sortable()",
"body": [
"\\$${1:page}->sortable(${2:});"
],
"description": "Is the page sortable (within the same parent) by the current user? Returns true or false."
},
"page->deleteable()": {
"prefix": "page deleteable()",
"body": [
"\\$${1:page}->deleteable(${2:});"
],
"description": "Is the page deleteable by the current user? Returns true or false."
},
"page->addStatus(Page::statusHidden)": {
"prefix": "page addStatus(Page::statusHidden)",
"body": [
"\\$${1:page}->addStatus(${2:Page::statusHidden});"
],
"description": "Add a status to this page."
},
"page->removeStatus(Page::statusHidden)": {
"prefix": "page removeStatus(Page::statusHidden)",
"body": [
"\\$${1:page}->removeStatus(${2:Page::statusHidden});"
],
"description": "Removes a status from this page."
},
"Page::statusOn (1)": {
"prefix": "Page::statusOn (1)",
"body": [
"Page::statusOn (${2:1});"
],
"description": "base status for all pages"
},
"Page::statusLocked (4)": {
"prefix": "Page::statusLocked (4)",
"body": [
"Page::statusLocked (${2:4});"
],
"description": "page locked for changes. Not enforced by the core, but checked by Process modules."
},
"Page::statusSystemID (8)": {
"prefix": "Page::statusSystemID (8)",
"body": [
"Page::statusSystemID (${2:8});"
],
"description": "page is for the system and may not be deleted or have it's id changed (everything else, okay)"
},
"Page::statusSystem (16)": {
"prefix": "Page::statusSystem (16)",
"body": [
"Page::statusSystem (${2:16});"
],
"description": "page is for the system and may not be deleted or have it's id, name, template or parent changed"
},
"Page::statusHidden (1024)": {
"prefix": "Page::statusHidden (1024)",
"body": [
"Page::statusHidden (${2:1024});"
],
"description": "page is excluded selector methods like $pages->find() and $page->children() unless status is specified, like \"status&1\""
},
"Page::statusUnpublished (2048)": {
"prefix": "Page::statusUnpublished (2048)",
"body": [
"Page::statusUnpublished (${2:2048});"
],
"description": "page is not published and is not renderable."
},
"Page::statusTrash (8192)": {
"prefix": "Page::statusTrash (8192)",
"body": [
"Page::statusTrash (${2:8192});"
],
"description": "page is in the trash"
},
"a->getTotal()": {
"prefix": "a getTotal()",
"body": [
"\\$${1:a}->getTotal(${2:});"
],
"description": "Get the total number of pages that were found from a $pages->find(\"selectors, limit=n\") operation that led to this PageArray. The number returned may be greater than the number of pages actually in this PageArray instance, and is used for calculating pagination. Whereas $p->count() will always return the number of pages actually in this PageArray instance."
},
"a->setTotal($n)": {
"prefix": "a setTotal($n)",
"body": [
"\\$${1:a}->setTotal($${2:n});"
],
"description": "Manually set the total number of pages in this PageArray. Used for calculating pagination."
},
"a->getLimit()": {
"prefix": "a getLimit()",
"body": [
"\\$${1:a}->getLimit(${2:});"
],
"description": "Get the number (n) from a \"limit=n\" portion of a selector that resulted in this PageArray. In pagination, this value represents the max items to display per page. If there was no limit applied, this will return 0."
},
"a->setLimit($n)": {
"prefix": "a setLimit($n)",
"body": [
"\\$${1:a}->setLimit($${2:n});"
],
"description": "Set the imposed limit on this PageArray. Used for pagination."
},
"a->getStart()": {
"prefix": "a getStart()",
"body": [
"\\$${1:a}->getStart(${2:});"
],
"description": "Get the number of the starting result that led to this PageArray in pagination. Returns 0 if in the first page of results."
},
"a->setStart($n)": {
"prefix": "a setStart($n)",
"body": [
"\\$${1:a}->setStart($${2:n});"
],
"description": "Set the 'start' limiter that resulted in this PageArray. Used in pagination."
},
"a->getSelectors()": {
"prefix": "a getSelectors()",
"body": [
"\\$${1:a}->getSelectors(${2:});"
],
"description": "Return the Selectors that led to this PageArray, or null if not set/applicable. Returns an instance of Selectors (WireArray) containing one or more Selector objects."
},
"a[$key]": {
"prefix": "a[$key]",
"body": [
"$${1:a[key];"
],
"description": "Returns the value of the item at the given $key, or null if not set."
},
"a->$key": {
"prefix": "a $key",
"body": [
"$${1:a}->key;"
],
"description": "Return the item indexed by $key or null if not found."
},
"a->get($key)": {
"prefix": "a get($key)",
"body": [
"\\$${1:a}->get($${2:key});"
],
"description": "Returns the value of the item at the given $key, or null if not set."
},
"a->find(\"selector\")": {
"prefix": "a find(\"selector\")",
"body": [
"\\$${1:a}->find(\"${2:selector}\");"
],
"description": "Return all items that match the given selector, or a blank WireArray if none found."
},
"a->get(\"selector\")": {
"prefix": "a get(\"selector\")",
"body": [
"\\$${1:a}->get(\"${2:selector}\");"
],
"description": "Return the first item that matches the given selector, or null if not found."
},
"a->getRandom()": {
"prefix": "a getRandom()",
"body": [
"\\$${1:a}->getRandom(${2:});"
],
"description": "Returns a single random item from this WireArray."
},
"a->findRandom($n)": {
"prefix": "a findRandom($n)",
"body": [
"\\$${1:a}->findRandom($${2:n});"
],
"description": "Get $n quantity of random elements from this WireArray. Returns a WireArray (or derived type)."
},
"a->findRandomTimed($n, $seed='Ymd')": {
"prefix": "a findRandomTimed($n, $seed='Ymd')",
"body": [
"\\$${1:a}->findRandomTimed($${2:n}, $${3:seed='Ymd'});"
],
"description": "Get a quantity of random elements from this WireArray that always returns the same random items for the same $seed. If $seed is a string, it is considered a PHP date() string. If no $seed is provided, today's date is used to seed the random number. Meaning, the default behavior is that it returns the same random items for a period of 1 day."
},
"a->slice($n)": {
"prefix": "a slice($n)",
"body": [
"\\$${1:a}->slice($${2:n});"
],
"description": "Returns a new WireArray containing a slice of items from the $n'th item to the end."
},
"a->slice($n, $limit)": {
"prefix": "a slice($n, $limit)",
"body": [
"\\$${1:a}->slice($${2:n}, $${3:limit});"
],
"description": "Returns a new WireArray containing a slice of items starting from the $n'th item and including up to $limit number of items."
},
"a->shift()": {
"prefix": "a shift()",
"body": [
"\\$${1:a}->shift(${2:});"
],
"description": "Remove (shift) the first $item from the WireArray and return it."
},
"a->pop()": {
"prefix": "a pop()",
"body": [
"\\$${1:a}->pop(${2:});"
],
"description": "Pop the last item off of the WireArray and return it."
},
"a->index($n)": {
"prefix": "a index($n)",
"body": [
"\\$${1:a}->index($${2:n});"
],
"description": "Returns a new WireArray containing the item at the given zero-based index."
},
"a->eq($n)": {
"prefix": "a eq($n)",
"body": [
"\\$${1:a}->eq($${2:n});"
],
"description": "Returns the single item at the given zero-based index, or NULL if it doesn't exist."
},
"a->first()": {
"prefix": "a first()",
"body": [
"\\$${1:a}->first(${2:});"
],
"description": "Returns the first item in the WireArray."
},
"a->last()": {
"prefix": "a last()",
"body": [
"\\$${1:a}->last(${2:});"
],
"description": "Returns the last item in the WireArray."
},
"a->getNext($item)": {
"prefix": "a getNext($item)",
"body": [
"\\$${1:a}->getNext($${2:item});"
],
"description": "Given an item already in the WireArray, return the item that comes after it in this WireArray or NULL if no match."
},
"a->getPrev($item)": {
"prefix": "a getPrev($item)",
"body": [
"\\$${1:a}->getPrev($${2:item});"
],
"description": "Given an item already in the WireArray, return the item that comes before it in this WireArray or NULL if no match."
},
"a->getArray()": {
"prefix": "a getArray()",
"body": [
"\\$${1:a}->getArray(${2:});"
],
"description": "Returns a regular PHP array of all items in this WireArray."
},
"a->getKeys()": {
"prefix": "a getKeys()",
"body": [
"\\$${1:a}->getKeys(${2:});"
],
"description": "Returns a regular PHP array of all keys used in this WireArray."
},
"a->getValues()": {
"prefix": "a getValues()",
"body": [
"\\$${1:a}->getValues(${2:});"
],
"description": "Returns a regular PHP array of all values used in this WireArray."
},
"a->unique()": {
"prefix": "a unique()",
"body": [
"\\$${1:a}->unique(${2:});"
],
"description": "Return a new WireArray that is the same as $a but with no duplicate values."
},
"a->implode([$delim], $key)": {
"prefix": "a implode([$delim], $key)",
"body": [
"\\$${1:a}->implode($${2:[delim]}, $${3:key});"
],
"description": "Implode all elements to a delimiter-separated string containing the given key/property from each item. Similar to PHP's implode() function."
},
"a->explode($key)": {
"prefix": "a explode($key)",
"body": [
"\\$${1:a}->explode($${2:key});"
],
"description": "Return a plain array of the requested key/property from each item. Similar to PHP's explode() function."
},
"a->and($item | $items)": {
"prefix": "a and($item | $items)",
"body": [
"\\$${1:a}->and($${2:item | items});"
],
"description": "Return a new copy of the WireArray with the given item or items appended."
},
"a->shuffle()": {
"prefix": "a shuffle()",
"body": [
"\\$${1:a}->shuffle(${2:});"
],
"description": "Randomize the order of all the items in the WireArray."
},
"a->sort(\"property\")": {
"prefix": "a sort(\"property\")",
"body": [
"\\$${1:a}->sort(\"${2:property}\");"
],
"description": "Sorts the WireArray by the given item property (string). You may also specify the property as \"property.subproperty\", where property resolves to a Wire derived object, and subproperty resolves to a property within that object. Prepend a minus sign \"-\" to the property name reverse the sort."
},
"a->filter(\"selector\")": {
"prefix": "a filter(\"selector\")",
"body": [
"\\$${1:a}->filter(\"${2:selector}\");"
],
"description": "Reduce the WireArray so that it only contains items that match the given selector."
},
"a->not(\"selector\")": {
"prefix": "a not(\"selector\")",
"body": [
"\\$${1:a}->not(\"${2:selector}\");"
],
"description": "Reduce the WireArray so that it only contains items that don't match the given selector."
},
"a->reverse()": {
"prefix": "a reverse()",
"body": [
"\\$${1:a}->reverse(${2:});"
],
"description": "Return a new WireArray containing the items in reverse order."
},
"a[] = $item": {
"prefix": "a[] = $item",
"body": [
"$${1:a[] = item;"
],
"description": "Add the given $item."
},
"a->add($item)": {
"prefix": "a add($item)",
"body": [
"\\$${1:a}->add($${2:item});"
],
"description": "Add the given $item. Supports import of page arrays (since 2.2)"
},
"a[$key] = $item": {
"prefix": "a[$key] = $item",
"body": [
"$${1:a[key] = item;"
],
"description": "Add the given $item, associating it with index $key."
},
"a->set($key, $item)": {
"prefix": "a set($key, $item)",
"body": [
"\\$${1:a}->set($${2:key}, $${3:item});"
],
"description": "Add the given $item, associating it with index $key."
},
"a->$key = $item": {
"prefix": "a $key = $item",
"body": [
"$${1:a}->key = item;"
],
"description": "Add the given $item, associating it with index $key."
},
"a->import($items)": {
"prefix": "a import($items)",
"body": [
"\\$${1:a}->import($${2:items});"
],
"description": "Given an array or WireArray of items, add them all."
},
"a->prepend($item)": {
"prefix": "a prepend($item)",
"body": [
"\\$${1:a}->prepend($${2:item});"
],
"description": "Prepend the given item to the beginning of the WireArray."
},
"a->append($item)": {
"prefix": "a append($item)",
"body": [
"\\$${1:a}->append($${2:item});"
],
"description": "Append the given item to the end of the WireArray."
},
"a->insertBefore($item, $existingItem)": {
"prefix": "a insertBefore($item, $existingItem)",
"body": [
"\\$${1:a}->insertBefore($${2:item}, $${3:existingItem});"
],
"description": "Insert an item (int|string|array|object) before an existing item (int|string|array|object)"
},
"a->insertAfter($item, $existingItem)": {
"prefix": "a insertAfter($item, $existingItem)",
"body": [
"\\$${1:a}->insertAfter($${2:item}, $${3:existingItem});"
],
"description": "Insert an item (int|string|array|object) after an existing item (int|string|array|object)"
},
"a->unshift($item)": {
"prefix": "a unshift($item)",
"body": [
"\\$${1:a}->unshift($${2:item});"
],
"description": "Prepend the given item to the beginning of the WireArray (same as prepend)"
},
"a->push($item)": {
"prefix": "a push($item)",
"body": [
"\\$${1:a}->push($${2:item});"
],
"description": "Push the given item onto the end of the WireArray."
},
"unset($array[$key])": {
"prefix": "unset($array[$key])",
"body": [
"unset($${2:array[key]});"
],
"description": "Removes the item with the given $key from the WireArray."
},
"a->remove($key)": {
"prefix": "a remove($key)",
"body": [
"\\$${1:a}->remove($${2:key});"
],
"description": "Removes the item with the given $key from the WireArray."
},
"a->remove($item)": {
"prefix": "a remove($item)",
"body": [
"\\$${1:a}->remove($${2:item});"
],
"description": "Removes the given $item from the WireArray."
},
"a->removeAll()": {
"prefix": "a removeAll()",
"body": [
"\\$${1:a}->removeAll(${2:});"
],
"description": "Removes all items from the WireArray."
},
"a->replace($itemA, $itemB)": {
"prefix": "a replace($itemA, $itemB)",
"body": [
"\\$${1:a}->replace($${2:itemA}, $${3:itemB});"
],
"description": "Replace one item with the other. If both items are already present, they will change places. If one item is not already present, it will replace the one that is. If neither item is present, both will be added at the end."
},
"a->count()": {
"prefix": "a count()",
"body": [
"\\$${1:a}->count(${2:});"
],
"description": "Returns the number of items in this WireArray."
},
"count($a)": {
"prefix": "count($a)",
"body": [
"count($${2:a});"
],
"description": "Returns the number of items in this WireArray."
},
"a->has($key)": {
"prefix": "a has($key)",
"body": [
"\\$${1:a}->has($${2:key});"
],
"description": "Is the given key part of this WireArray?"
},
"a->has(\"selector\")": {
"prefix": "a has(\"selector\")",
"body": [
"\\$${1:a}->has(\"${2:selector}\");"
],
"description": "Does the given selector match any items in this WireArray?"
},
"a->has($object)": {
"prefix": "a has($object)",
"body": [
"\\$${1:a}->has($${2:object});"
],
"description": "Is $object in the WireArray? $object must be an valid type of the WireArray."
},
"isset($a[$key])": {
"prefix": "isset($a[$key])",
"body": [
"isset($${2:a[key]});"
],
"description": "Returns true if the given $key is set with an item."
},
"a->isValidItem($item)": {
"prefix": "a isValidItem($item)",
"body": [
"\\$${1:a}->isValidItem($${2:item});"
],
"description": "Is the given item a valid type for this WireArray?"
},
"a->isValidKey($key)": {
"prefix": "a isValidKey($key)",
"body": [
"\\$${1:a}->isValidKey($${2:key});"
],
"description": "Is the given $key valid to use for this WireArray?"
},
"a->getItemKey($item)": {
"prefix": "a getItemKey($item)",
"body": [
"\\$${1:a}->getItemKey($${2:item});"
],
"description": "Get the key used by $item or NULL if not available."
},
"a->setTrackChanges()": {
"prefix": "a setTrackChanges()",
"body": [
"\\$${1:a}->setTrackChanges(${2:});"
],
"description": "Turn on change tracking"
},
"a->setTrackChanges(false)": {
"prefix": "a setTrackChanges(false)",
"body": [
"\\$${1:a}->setTrackChanges(${2:false});"
],
"description": "Turn change tracking OFF"
},
"a->resetTrackChanges()": {
"prefix": "a resetTrackChanges()",
"body": [
"\\$${1:a}->resetTrackChanges(${2:});"
],
"description": "Reset any changes that have been tracked and start tracking again."
},
"a->resetTrackChanges(false)": {
"prefix": "a resetTrackChanges(false)",
"body": [
"\\$${1:a}->resetTrackChanges(${2:false});"
],
"description": "Reset any changes that have been tracked and stop tracking."
},
"a->isChanged()": {
"prefix": "a isChanged()",
"body": [
"\\$${1:a}->isChanged(${2:});"
],
"description": "Has this object changed since tracking was turned on?"
},
"a->getChanges()": {
"prefix": "a getChanges()",
"body": [
"\\$${1:a}->getChanges(${2:});"
],
"description": "Return an array of item keys that have changed while change tracking was on."
},
"a->getItemsAdded()": {
"prefix": "a getItemsAdded()",
"body": [
"\\$${1:a}->getItemsAdded(${2:});"
],
"description": "Return an array of items that have been added since change tracking was turned on."
},
"a->getItemsRemoved()": {
"prefix": "a getItemsRemoved()",
"body": [
"\\$${1:a}->getItemsRemoved(${2:});"
],
"description": "Return an array of items that have been removed since change tracking was turned on."
},
"a->makeBlankItem()": {
"prefix": "a makeBlankItem()",
"body": [
"\\$${1:a}->makeBlankItem(${2:});"
],
"description": "Make a new blank item suitable for storage in this WireArray."
},
"a->makeNew()": {
"prefix": "a makeNew()",
"body": [
"\\$${1:a}->makeNew(${2:});"
],
"description": "Make a new blank WireArray of the same type as $a."
},
"a->data([$key], [$value])": {
"prefix": "a data([$key], [$value])",
"body": [
"\\$${1:a}->data($${2:[key]}, $${3:[value]});"
],
"description": "Set or retrieve an arbitrary/extra data value in this WireArray."
},
"files->path": {
"prefix": "files path",
"body": [
"$${1:files}->path;"
],
"description": "Returns the full server disk path where files are stored"
},
"files->url": {
"prefix": "files url",
"body": [
"$${1:files}->url;"
],
"description": "Returns the URL where files are stored"
},
"files->page": {
"prefix": "files page",
"body": [
"$${1:files}->page;"
],
"description": "Returns the $page that contains this set of files"
},
"files->delete($file)": {
"prefix": "files delete($file)",
"body": [
"\\$${1:files}->delete($${2:file});"
],
"description": "Removes the file and deletes from disk when page is saved (alias of remove)"
},
"files->deleteAll()": {
"prefix": "files deleteAll()",
"body": [
"\\$${1:files}->deleteAll(${2:});"
],
"description": "Removes all items and deletes them from disk when page is saved @advanced"
},
"file->url": {
"prefix": "file url",
"body": [
"$${1:file}->url;"
],
"description": "URL to the file on the server"
},
"file->httpUrl": {
"prefix": "file httpUrl",
"body": [
"$${1:file}->httpUrl;"
],
"description": "Return the web accessible URL (with schema and hostname) to this Pagefile"
},
"file->filename": {
"prefix": "file filename",
"body": [
"$${1:file}->filename;"
],
"description": "full disk path to the file on the server"
},
"file->name": {
"prefix": "file name",
"body": [
"$${1:file}->name;"
],
"description": "Returns the filename without the path (basename)"
},
"file->description": {
"prefix": "file description",
"body": [
"$${1:file}->description;"
],
"description": "value of the file's description field (text). Note you can set this property directly"
},
"file->ext": {
"prefix": "file ext",
"body": [
"$${1:file}->ext;"
],
"description": "file's extension (i.e. last 3 or so characters)"
},
"file->filesize": {
"prefix": "file filesize",
"body": [
"$${1:file}->filesize;"
],
"description": "file size, number of bytes"
},
"file->filesizeStr": {
"prefix": "file filesizeStr",
"body": [
"$${1:file}->filesizeStr;"
],
"description": "file size as a formatted string"
},
"(string) $file": {
"prefix": "(string) $file",
"body": [
"$${1:(string) file;"
],
"description": "returns the file's name (no path)"
},
"file->pagefiles": {
"prefix": "file pagefiles",
"body": [
"$${1:file}->pagefiles;"
],
"description": "the $files array that contains this file"
},
"file->page": {
"prefix": "file page",
"body": [
"$${1:file}->page;"
],
"description": "the $page that contains this file"
},
"file->rename($name)": {
"prefix": "file rename($name)",
"body": [
"\\$${1:file}->rename($${2:name});"
],
"description": "Rename this file to the given name (no path). Returns true on success, false on failure."
},
"file->getNext()": {
"prefix": "file getNext()",
"body": [
"\\$${1:file}->getNext(${2:});"
],
"description": "Returns the next file in a multi-file field, or NULL if at the end"
},
"file->getPrev()": {
"prefix": "file getPrev()",
"body": [
"\\$${1:file}->getPrev(${2:});"
],
"description": "Returns the previous file in a multi-file field, or NULL if at the beginning"
},
"image->width": {
"prefix": "image width",
"body": [
"$${1:image}->width;"
],
"description": "Width of image, in pixels"
},
"image->height": {
"prefix": "image height",
"body": [
"$${1:image}->height;"
],
"description": "Height of image, in pixels"
},
"image->original": {
"prefix": "image original",
"body": [
"$${1:image}->original;"
],
"description": "Reference to original $image, if this is a resized version."
},
"image->size($width, $height, $options)": {
"prefix": "image size($width, $height, $options)",
"body": [
"\\$${1:image}->size($${2:width}, $${3:height}, $${4:options});"
],
"description": "Return a new $image with the given dimensions. By default it will get upscaled and center cropped with a quality of 90%. To resize and keep proportions you can 0 for height or width value. As third argument you can pass an array to overwrite the default settings: $defaultOptions = array('upscaling' => true,'cropping' => true,'quality' => 90);"
},
"image->width($width)": {
"prefix": "image width($width)",
"body": [
"\\$${1:image}->width($${2:width});"
],
"description": "Return a new $image with the given width (proportional height, center crop)"
},
"image->height($height)": {
"prefix": "image height($height)",
"body": [
"\\$${1:image}->height($${2:height});"
],
"description": "Return a new $image with the given height (proportional width, center crop)"
},
"image->getVariations()": {
"prefix": "image getVariations()",
"body": [
"\\$${1:image}->getVariations(${2:});"
],
"description": "Returns a WireArray (Pageimages) of all size variations of this image"
},
"image->removeVariations()": {
"prefix": "image removeVariations()",
"body": [
"\\$${1:image}->removeVariations(${2:});"
],
"description": "Deletes all size variations of this image (be careful)"
},
"templates->find(\"selector\")": {
"prefix": "templates find(\"selector\")",
"body": [
"\\$${1:templates}->find(\"${2:selector}\");"
],
"description": "Return the templates matching the given selector query."
},
"templates->get(\"name\")": {
"prefix": "templates get(\"name\")",
"body": [
"\\$${1:templates}->get(\"${2:name}\");"
],
"description": "Return the template with the given name"
},
"templates->save($template)": {
"prefix": "templates save($template)",
"body": [
"\\$${1:templates}->save($${2:template});"
],
"description": "Save the given template instance."
},
"templates->delete($template)": {
"prefix": "templates delete($template)",
"body": [
"\\$${1:templates}->delete($${2:template});"
],
"description": "Delete the given template instance. Note that this will throw a fatal error if the template is in use by any pages."
},
"template->id": {
"prefix": "template id",
"body": [
"$${1:template}->id;"
],
"description": "Get or set the template's numbered database ID."
},
"template->name": {
"prefix": "template name",
"body": [
"$${1:template}->name;"
],
"description": "Get or set the template's name."
},
"template->filename": {
"prefix": "template filename",
"body": [
"$${1:template}->filename;"
],
"description": "Get or set a template's filename, including path (this is auto-generated from the name, though you may modify it at runtime if it suits your need)."
},
"template->label": {
"prefix": "template label",
"body": [
"$${1:template}->label;"
],
"description": "Optional short text label to describe Template."
},
"template->fieldgroup": {
"prefix": "template fieldgroup",
"body": [
"$${1:template}->fieldgroup;"
],
"description": "Get or set a template's Fieldgroup. Can also be used to iterate a template's fields."
},
"template->fields": {
"prefix": "template fields",
"body": [
"$${1:template}->fields;"
],
"description": "Syntactical alias for $template->fieldgroup. Use whatever makes more sense for your code readability."
},
"template->cacheTime": {
"prefix": "template cacheTime",
"body": [
"$${1:template}->cacheTime;"
],
"description": "Get or set the number of seconds this template's output should be cached (default is 0)."
},
"template->childrenTemplatesID": {
"prefix": "template childrenTemplatesID",
"body": [
"$${1:template}->childrenTemplatesID;"
],
"description": "Get or set the template database ID that children of pages using this template default to. 0 is the default and indicates no selection. Set to -1 to disallow pages using this template from having children."
},
"template->allowPageNum": {
"prefix": "template allowPageNum",
"body": [
"$${1:template}->allowPageNum;"
],
"description": "Get or set whether pages using this template can have URL-based page numbers. Set to 1 for yes or 0 for no. Default is 0."
},
"template->urlSegments": {
"prefix": "template urlSegments",
"body": [
"$${1:template}->urlSegments;"
],
"description": "Get or set whether pages using this template can make use of URL segments. Set to 1 for yes or 0 for no. Default is 0."
},
"template->slashUrls": {
"prefix": "template slashUrls",
"body": [
"$${1:template}->slashUrls;"
],
"description": "Get or set whether pages using this template should have URLs that end with a slash. Set to 1 for yes or 0 for no. Default is 1."
},
"template->redirectLogin": {
"prefix": "template redirectLogin",
"body": [
"$${1:template}->redirectLogin;"
],
"description": "Get or set what should happen when a user attempts access to a page using this template, and they don't have access to. Set to 0 to show the 404 page, or 1 to redirect to the login page. Default is 0."
},
"template->protocol": {
"prefix": "template protocol",
"body": [
"$${1:template}->protocol;"
],
"description": "Get or set what protocol is required to access pages using this template. If the user attempts access from the wrong protocol, it will be redirected to the right protocol. Set to 0 to allow either HTTP or HTTPS. Set to 1 to allow HTTPS only. Set to -1 to allow HTTP only. Default is 0."
},
"template->get($property)": {
"prefix": "template get($property)",
"body": [
"\\$${1:template}->get($${2:property});"
],
"description": "Get the value of a template's property (same as $template->$property)"
},
"template->set($property, $value)": {
"prefix": "template set($property, $value)",
"body": [
"\\$${1:template}->set($${2:property}, $${3:value});"
],
"description": "Set the value of a template's property (same as $template->$property = $value)."
},
"template->getNumPages()": {
"prefix": "template getNumPages()",
"body": [
"\\$${1:template}->getNumPages(${2:});"
],
"description": "Return the number of pages using this template."
},
"template->hasField(string|int|Field)": {
"prefix": "template hasField(string|int|Field)",
"body": [
"\\$${1:template}->hasField(${2:string|int|Field});"
],
"description": "Does this template have the given field?"
},
"template->save()": {
"prefix": "template save()",
"body": [
"\\$${1:template}->save(${2:});"
],
"description": "Save this template to the database."
},
"fields->find(\"selector\")": {
"prefix": "fields find(\"selector\")",
"body": [
"\\$${1:fields}->find(\"${2:selector}\");"
],
"description": "Find all fields matching the given selector"
},
"fields->get(\"name\")": {
"prefix": "fields get(\"name\")",
"body": [
"\\$${1:fields}->get(\"${2:name}\");"
],
"description": "Get the field specified by the given field name"
},
"fields->get(123)": {
"prefix": "fields get(123)",
"body": [
"\\$${1:fields}->get(${2:123});"
],
"description": "Get the field specified by the given field ID (integer)"
},
"fields->get(\"selector\")": {
"prefix": "fields get(\"selector\")",
"body": [
"\\$${1:fields}->get(\"${2:selector}\");"
],
"description": "Get the first matching field specified by the given selector"
},
"fields->save($field)": {
"prefix": "fields save($field)",
"body": [
"\\$${1:fields}->save($${2:field});"
],
"description": "Save the given Field object"
},
"fields->delete($field)": {
"prefix": "fields delete($field)",
"body": [
"\\$${1:fields}->delete($${2:field});"
],
"description": "Delete the given Field object"
},
"(string) $field": {
"prefix": "(string) $field",
"body": [
"$${1:(string) field;"
],
"description": "Casting a Field as a string returns the field's name"
},
"field->id": {
"prefix": "field id",
"body": [
"$${1:field}->id;"
],
"description": "Numeric ID of this field"
},
"field->name": {
"prefix": "field name",
"body": [
"$${1:field}->name;"
],
"description": "Name of this field (name string)"
},
"field->label": {
"prefix": "field label",
"body": [
"$${1:field}->label;"
],
"description": "Text label for this field, appears as the element in the editor"
},
"field->type": {
"prefix": "field type",
"body": [
"$${1:field}->type;"
],
"description": "The type of field, refers to a Fieldtype plugin module"
},
"field->flags": {
"prefix": "field flags",
"body": [
"$${1:field}->flags;"
],
"description": "Bitwise flags of the field: if($field->flags & Field::flagAutojoin) // field has the \"autojoin\" flag set if($field->flags & Field::flagGlobal) // field has the \"global\" flag set."
},
"field->get($key)": {
"prefix": "field get($key)",
"body": [
"\\$${1:field}->get($${2:key});"
],
"description": "Get a field property (the properties above, or a custom property) Same as $field->$key"
},
"field->set($key, $value)": {
"prefix": "field set($key, $value)",
"body": [
"\\$${1:field}->set($${2:key}, $${3:value});"
],
"description": "Set a field property. Can be any one of the above or something else for a custom setting. Same as $field->$key = $value"
},
"field->save()": {
"prefix": "field save()",
"body": [
"\\$${1:field}->save(${2:});"
],
"description": "Save this field. Same as $fields->save($field)"
},
"field->numFieldgroups()": {
"prefix": "field numFieldgroups()",
"body": [
"\\$${1:field}->numFieldgroups(${2:});"
],
"description": "Returns the number of fieldgroups that use this field"
},
"field->getFieldgroups()": {
"prefix": "field getFieldgroups()",
"body": [
"\\$${1:field}->getFieldgroups(${2:});"
],
"description": "Returns an array of fieldgroups that use this field"
},
"field->getTable()": {
"prefix": "field getTable()",
"body": [
"\\$${1:field}->getTable(${2:});"
],
"description": "Returns the name of the database table created by this field"
},
"field->getInputfield($page)": {
"prefix": "field getInputfield($page)",
"body": [
"\\$${1:field}->getInputfield($${2:page});"
],
"description": "Returns an Inputfield object associated with this field for use on $page"
},
"users->find(\"selector\")": {
"prefix": "users find(\"selector\")",
"body": [
"\\$${1:users}->find(\"${2:selector}\");"
],
"description": "Find user(s) matching given selector."
},
"users->get(name|id|selector)": {
"prefix": "users get(name|id|selector)",
"body": [
"\\$${1:users}->get(${2:name|id|selector});"
],
"description": "Get user by given name, numeric ID or a selector string."
},
"users->add(\"name\")": {
"prefix": "users add(\"name\")",
"body": [
"\\$${1:users}->add(\"${2:name}\");"
],
"description": "Add new User with the given name and return it."
},
"users->save($user)": {
"prefix": "users save($user)",
"body": [
"\\$${1:users}->save($${2:user});"
],
"description": "Save given user. $user must be valid user object."
},
"users->delete($user)": {
"prefix": "users delete($user)",
"body": [
"\\$${1:users}->delete($${2:user});"
],
"description": "Delete given user. $user must be valid user object."
},
"user->id": {
"prefix": "user id",
"body": [
"$${1:user}->id;"
],
"description": "Numeric ID of this user"
},
"user->name": {
"prefix": "user name",
"body": [
"$${1:user}->name;"
],
"description": "Get or set the user's login name."
},
"user->email": {
"prefix": "user email",
"body": [
"$${1:user}->email;"
],
"description": "Get or set email address for this user."
},
"user->pass": {
"prefix": "user pass",
"body": [
"$${1:user}->pass;"
],
"description": "The user's hashed password. Note that this returns a hashed version of the password, so it is not typically useful to get this property. However, it is useful to set this property if you want to change the password. When you change a password, it is assumed to be the non-hashed/non-encrypted version. ProcessWire will hash it automatically when the user is saved."
},
"user->roles": {
"prefix": "user roles",
"body": [
"$${1:user}->roles;"
],
"description": "Get roles this user has. Returns PageArray."
},
"user->isGuest()": {
"prefix": "user isGuest()",
"body": [
"\\$${1:user}->isGuest(${2:});"
],
"description": "Is this the Guest user? Returns true or false."
},
"user->isSuperuser()": {
"prefix": "user isSuperuser()",
"body": [
"\\$${1:user}->isSuperuser(${2:});"
],
"description": "Is this the Superuser? Returns true or false."
},
"user->isLoggedin()": {
"prefix": "user isLoggedin()",
"body": [
"\\$${1:user}->isLoggedin(${2:});"
],
"description": "Is this user logged in? Returns true or false."
},
"user->get($property)": {
"prefix": "user get($property)",
"body": [
"\\$${1:user}->get($${2:property});"
],
"description": "Get a property value from the user. Same as $user->[property]."
},
"user->set($property, $value)": {
"prefix": "user set($property, $value)",
"body": [
"\\$${1:user}->set($${2:property}, $${3:value});"
],
"description": "Set a property value. Same as $user->[property] = $value;"
},
"user->save()": {
"prefix": "user save()",
"body": [
"\\$${1:user}->save(${2:});"
],
"description": "Save user to the database."
},
"user->hasRole($role)": {
"prefix": "user hasRole($role)",
"body": [
"\\$${1:user}->hasRole($${2:role});"
],
"description": "Does the user have the given role? Returns true or false."
},
"user->addRole($role)": {
"prefix": "user addRole($role)",
"body": [
"\\$${1:user}->addRole($${2:role});"
],
"description": "Add the given Role to this user."
},
"user->removeRole($role)": {
"prefix": "user removeRole($role)",
"body": [
"\\$${1:user}->removeRole($${2:role});"
],
"description": "Remove a given Role from this user."
},
"user->hasPermission($permission)": {
"prefix": "user hasPermission($permission)",
"body": [
"\\$${1:user}->hasPermission($${2:permission});"
],
"description": "Does the user have the given permission? Returns true or false."
},
"user->hasPermission($permission, $page)": {
"prefix": "user hasPermission($permission, $page)",
"body": [
"\\$${1:user}->hasPermission($${2:permission}, $${3:page});"
],
"description": "Does the user have the given permission name on $page? Returns true or false."
},
"roles->find(\"selector\")": {
"prefix": "roles find(\"selector\")",
"body": [
"\\$${1:roles}->find(\"${2:selector}\");"
],
"description": "Find roles with given selector"
},
"roles->get(name|id)": {
"prefix": "roles get(name|id)",
"body": [
"\\$${1:roles}->get(${2:name|id});"
],
"description": "Get role with given name or id"
},
"roles->add(\"name\")": {
"prefix": "roles add(\"name\")",
"body": [
"\\$${1:roles}->add(\"${2:name}\");"
],
"description": "Add new Role with the given name and return it."
},
"roles->save($role)": {
"prefix": "roles save($role)",
"body": [
"\\$${1:roles}->save($${2:role});"
],
"description": "Save given role. $roles must be an instance of Role."
},
"roles->delete($role)": {
"prefix": "roles delete($role)",
"body": [
"\\$${1:roles}->delete($${2:role});"
],
"description": "Delete given role. $roles must be an instance of Role."
},
"role->id": {
"prefix": "role id",
"body": [
"$${1:role}->id;"
],
"description": "Get Numeric ID of this role."
},
"role->name": {
"prefix": "role name",
"body": [
"$${1:role}->name;"
],
"description": "Get or set name (string) of this role."
},
"role->permissions": {
"prefix": "role permissions",
"body": [
"$${1:role}->permissions;"
],
"description": "PageArray of permissions assigned to Role."
},
"role->get($key)": {
"prefix": "role get($key)",
"body": [
"\\$${1:role}->get($${2:key});"
],
"description": "Get property value by key"
},
"role->save()": {
"prefix": "role save()",
"body": [
"\\$${1:role}->save(${2:});"
],
"description": "Saves the role"
},
"role->hasPermission(name|id|Permission)": {
"prefix": "role hasPermission(name|id|Permission)",
"body": [
"\\$${1:role}->hasPermission(${2:name|id|Permission});"
],
"description": "Does this role have the given permission?"
},
"role->addPermission(name|id|Permission)": {
"prefix": "role addPermission(name|id|Permission)",
"body": [
"\\$${1:role}->addPermission(${2:name|id|Permission});"
],
"description": "Add the given permission. This is the same as $role->permissions->add($permission) except this one will accept name, ID or Permission."
},
"role->removePermission(name|id|Permission)": {
"prefix": "role removePermission(name|id|Permission)",
"body": [
"\\$${1:role}->removePermission(${2:name|id|Permission});"
],
"description": "Remove the given permission. This is the same as $role->permissions->remove($permission) except this one will accept name, ID or Permission."
},
"permissions->find(\"selector\")": {
"prefix": "permissions find(\"selector\")",
"body": [
"\\$${1:permissions}->find(\"${2:selector}\");"
],
"description": "Get permission(s) by matching given selector string."
},
"permissions->get(name|id)": {
"prefix": "permissions get(name|id)",
"body": [
"\\$${1:permissions}->get(${2:name|id});"
],
"description": "Get permission matching given name or id."
},
"permissions->add(\"name\")": {
"prefix": "permissions add(\"name\")",
"body": [
"\\$${1:permissions}->add(\"${2:name}\");"
],
"description": "Add new permission with the given name and return it."
},
"permissions->save($permission)": {
"prefix": "permissions save($permission)",
"body": [
"\\$${1:permissions}->save($${2:permission});"
],
"description": "Save given permission. $permission must be an instance of Permission."
},
"permissions->delete($permission)": {
"prefix": "permissions delete($permission)",
"body": [
"\\$${1:permissions}->delete($${2:permission});"
],
"description": "Delete given permission. $permission must be an instance of Permission."
},
"permission->id": {
"prefix": "permission id",
"body": [
"$${1:permission}->id;"
],
"description": "Numeric ID of this permission."
},
"permission->name": {
"prefix": "permission name",
"body": [
"$${1:permission}->name;"
],
"description": "Get or set the permission name."
},
"permission->title": {
"prefix": "permission title",
"body": [
"$${1:permission}->title;"
],
"description": "Get or set the title of the permisson."
},
"permission->get($key)": {
"prefix": "permission get($key)",
"body": [
"\\$${1:permission}->get($${2:key});"
],
"description": "Get a property value by key."
},
"permission->save()": {
"prefix": "permission save()",
"body": [
"\\$${1:permission}->save(${2:});"
],
"description": "Save the permission."
},
"permission->delete()": {
"prefix": "permission delete()",
"body": [
"\\$${1:permission}->delete(${2:});"
],
"description": "Delete the permission."
},
"any_field=any_value": {
"prefix": "any_field=any_value",
"body": [
"${1:any_field=any_value}"
],
"description": "Match any of your own fields using any operator and any value."
},
"limit=n": {
"prefix": "limit=n",
"body": [
"${1:limit=n}"
],
"description": "Limit the results to n Number"
},
"sort=field": {
"prefix": "sort=field",
"body": [
"${1:sort=field}"
],
"description": "Sort by a field. This may any field. Use \"-\" prefix to reverse sorting. sort=-field"
},
"parent=id": {
"prefix": "parent=id",
"body": [
"${1:parent=id}"
],
"description": "Page parent using ID"
},
"parent=$page": {
"prefix": "parent=$page",
"body": [
"$${1:parent=page;"
],
"description": "Page parent using an page object"
},
"parent=/path/to/page/": {
"prefix": "parent=/path/to/page/",
"body": [
"${1:parent=/path/to/page/}"
],
"description": "Page parent using path"
},
"has_parent=$page": {
"prefix": "has_parent=$page",
"body": [
"$${1:has_parent=page;"
],
"description": "Limit to a certain parent (recursively all children). Only one parent can be used at a time."
},
"has_parent=/path/to/page/": {
"prefix": "has_parent=/path/to/page/",
"body": [
"${1:has_parent=/path/to/page/}"
],
"description": "Limit to a certain parent (recursively all children). Only one parent can be used at a time."
},
"has_parent=id": {
"prefix": "has_parent=id",
"body": [
"${1:has_parent=id}"
],
"description": "Limit to a certain parent (recursively all children). Only one parent can be used at a time."
},
"path=/path/to/page/": {
"prefix": "path=/path/to/page/",
"body": [
"${1:path=/path/to/page/}"
],
"description": "Get Page with the path specified"
},
"template=name": {
"prefix": "template=name",
"body": [
"${1:template=name}"
],
"description": "Limit to a certain template. Use \"|\" to have multiple OR's. template=name|name"
},
"template=$template": {
"prefix": "template=$template",
"body": [
"$${1:template=template;"
],
"description": "You can also use a template object to compare"
},
"start=n": {
"prefix": "start=n",
"body": [
"${1:start=n}"
],
"description": "Set start offset"
},
"end=n": {
"prefix": "end=n",
"body": [
"${1:end=n}"
],
"description": "Set end offset (may be used instead of limit=n)"
},
"include=all": {
"prefix": "include=all",
"body": [
"${1:include=all}"
],
"description": "Include all hidden and unpublished pages and pages that user doesn't have access to view."
},
"include=hidden": {
"prefix": "include=hidden",
"body": [
"${1:include=hidden}"
],
"description": "Include hidden pages in queries."
},
"check_access=0": {
"prefix": "check_access=0",
"body": [
"${1:check_access=0}"
],
"description": "Include pages that user doesn't have access to view."
},
"children.count=n": {
"prefix": "children.count=n",
"body": [
"${1:children.count=n}"
],
"description": "Pages with a certain count of children may also be used with greater than / less than operators."
},
"created=timestamp": {
"prefix": "created=timestamp",
"body": [
"${1:created=timestamp}"
],
"description": "Usually used with < > to compare timestamps"
},
"modified=timestamp": {
"prefix": "modified=timestamp",
"body": [
"${1:modified=timestamp}"
],
"description": "Usually used with < > to compare timestamps"
},
"created_users_id=int": {
"prefix": "created_users_id=int",
"body": [
"${1:created_users_id=int}"
],
"description": "Pages created with specified user id."
},
"modified_users_id=int": {
"prefix": "modified_users_id=int",
"body": [
"${1:modified_users_id=int}"
],
"description": "Pages modified with specified user id."
},
"input->get": {
"prefix": "input get",
"body": [
"$${1:input}->get;"
],
"description": "Provides access to GET variables"
},
"input->get->name": {
"prefix": "input get name",
"body": [
"$${1:input}->get->name;"
],
"description": "Access as object property"
},
"input->get[\"name\"]": {
"prefix": "input get[\"name\"]",
"body": [
"$${1:input}->get[\"${2:name}\"];"
],
"description": "Access as array index"
},
"input->get(\"name\")": {
"prefix": "input get(\"name\")",
"body": [
"\\$${1:input}->get(\"${2:name}\");"
],
"description": "Access as function"
},
"input->post": {
"prefix": "input post",
"body": [
"$${1:input}->post;"
],
"description": "Provides access to POST variables"
},
"input->post->name": {
"prefix": "input post name",
"body": [
"$${1:input}->post->name;"
],
"description": "Access as object property"
},
"input->post[\"name\"]": {
"prefix": "input post[\"name\"]",
"body": [
"$${1:input}->post[\"${2:name}\"];"
],
"description": "Access as array index"
},
"input->post(\"name\")": {
"prefix": "input post(\"name\")",
"body": [
"\\$${1:input}->post(\"${2:name}\");"
],
"description": "Access as function"
},
"input->cookie": {
"prefix": "input cookie",
"body": [
"$${1:input}->cookie;"
],
"description": "Provides access to your COOKIE variables"
},
"input->cookie->name": {
"prefix": "input cookie name",
"body": [
"$${1:input}->cookie->name;"
],
"description": "Access as object property"
},
"input->cookie[\"name\"]": {
"prefix": "input cookie[\"name\"]",
"body": [
"$${1:input}->cookie[\"${2:name}\"];"
],
"description": "Access as array index"
},
"input->cookie(\"name\")": {
"prefix": "input cookie(\"name\")",
"body": [
"\\$${1:input}->cookie(\"${2:name}\");"
],
"description": "Access as function"
},
"input->whitelist($key, $value)": {
"prefix": "input whitelist($key, $value)",
"body": [
"\\$${1:input}->whitelist($${2:key}, $${3:value});"
],
"description": "Set a whitelist value"
},
"input->whitelist($key)": {
"prefix": "input whitelist($key)",
"body": [
"\\$${1:input}->whitelist($${2:key});"
],
"description": "Get a whitelist value"
},
"input->urlSegments": {
"prefix": "input urlSegments",
"body": [
"$${1:input}->urlSegments;"
],
"description": "Retrieve all URL segments (array). This requires url segments are enabled on the template of the requested page. You can turn it on or off under the url tab when editing a template."
},
"input->urlSegment($n)": {
"prefix": "input urlSegment($n)",
"body": [
"\\$${1:input}->urlSegment($${2:n});"
],
"description": "Retrieve the $n'th URL segment (integer). urlSegment(1)=/page/aaa/; urlSegment(2)=/page/aaa/bbb/; urlSegment(3)=/page/aaa/bbb/ccc/. The maximum segments allowed can be adjusted in your sites config.php. Alternative syntax: $input->urlSegment1;$input->urlSegment2;$input->urlSegment3."
},
"input->urlSegment1 (2,3,..)": {
"prefix": "input urlSegment1 (2,3,..)",
"body": [
"\\$${1:input}->urlSegment1 (${2:2}, ${3:3}, ${4:..});"
],
"description": "Retrieve the $n'th URL segment. Alternative syntax. The maximum segments allowed can be adjusted in your sites config.php."
},
"input->pageNum": {
"prefix": "input pageNum",
"body": [
"$${1:input}->pageNum;"
],
"description": "Returns the current page number from the URL (1�999)"
},
"sanitizer->email($value)": {
"prefix": "sanitizer email($value)",
"body": [
"\\$${1:sanitizer}->email($${2:value});"
],
"description": "Sanitizes a value for an email address, then filters it. If not valid after sanitization, this function returns a blank string."
},
"sanitizer->fieldName($value)": {
"prefix": "sanitizer fieldName($value)",
"body": [
"\\$${1:sanitizer}->fieldName($${2:value});"
],
"description": "Sanitizes a value for a Field name. Same as the name() filter, except that it doesn't allow dashes."
},
"sanitizer->name($value)": {
"prefix": "sanitizer name($value)",
"body": [
"\\$${1:sanitizer}->name($${2:value});"
],
"description": "Sanitizes a value for a ProcessWire name, meaning all characters except for these ASCII characters: \"a-zA-Z0-9_.\" (not including the quotes) are removed. It also truncates the length to 128 characters."
},
"sanitizer->pageName($value)": {
"prefix": "sanitizer pageName($value)",
"body": [
"\\$${1:sanitizer}->pageName($${2:value});"
],
"description": "Sanitizes a value for a URL friendly Page name. Same as the name() filter, except that it converts uppercase to lowercase, and it attempts UTF-8 to ASCII conversion."
},
"sanitizer->pageName($value, true)": {
"prefix": "sanitizer pageName($value, true)",
"body": [
"\\$${1:sanitizer}->pageName($${2:value}, ${3:true});"
],
"description": "Sanitizes a value for a URL friendly Page name and cleans out leading or trailing dashes, and converts double dashes to single dashes. Use this if you are passing in a headline to convert to a page name (for example). If second parameter is \"Sanitizer::translate\" it will use the language char conversion defined in InputfieldPageName module settings."
},
"sanitizer->selectorField($value)": {
"prefix": "sanitizer selectorField($value)",
"body": [
"\\$${1:sanitizer}->selectorField($${2:value});"
],
"description": "Sanitizes a field name as used in a selector value. This function is only necessary if you are dealing with user submitted field names. This is rarely the case in the author's experience, but provided here for consistency with selectorValue()"
},
"sanitizer->selectorValue($value)": {
"prefix": "sanitizer selectorValue($value)",
"body": [
"\\$${1:sanitizer}->selectorValue($${2:value});"
],
"description": "Sanitizes a string that needs to appear in a selector value. Replaces disallowed characters with spaces. If value is not already quoted, it will add quotes if it determines they are necessary (like if it contains commas). It limits the length to 100 characters (multibyte safe)."
},
"sanitizer->text($value)": {
"prefix": "sanitizer text($value)",
"body": [
"\\$${1:sanitizer}->text($${2:value});"
],
"description": "Sanitize a single line of input text. Removes tags, removes newline characters, and truncates length to 1024 characters. This is multibyte safe if your PHP has multibyte support."
},
"sanitizer->text($value, $options)": {
"prefix": "sanitizer text($value, $options)",
"body": [
"\\$${1:sanitizer}->text($${2:value}, $${3:options});"
],
"description": "Same as the above, except you may provide an $options array to change the behavior. You may specify one or more options in the $options array. See the reference of $options later in this page."
},
"sanitizer->textarea($value)": {
"prefix": "sanitizer textarea($value)",
"body": [
"\\$${1:sanitizer}->textarea($${2:value});"
],
"description": "Same as the text() function above, except that multiple lines are allowed and maxLength is 16k."
},
"sanitizer->textarea($value, $options)": {
"prefix": "sanitizer textarea($value, $options)",
"body": [
"\\$${1:sanitizer}->textarea($${2:value}, $${3:options});"
],
"description": "Same as textarea() except that you may modify the options documented later in this page, noting that multiLine is already true, and maxLength is already 16384."
},
"sanitizer->url($value)": {
"prefix": "sanitizer url($value)",
"body": [
"\\$${1:sanitizer}->url($${2:value});"
],
"description": "Filters a URL value. Returns a valid URL or blank if it can't be made valid. If URL contains a domain and is valid but missing a protocol (like http://) it will add it. It won't add a protocol to local/relative URLs."
},
"sanitizer->username($value)": {
"prefix": "sanitizer username($value)",
"body": [
"\\$${1:sanitizer}->username($${2:value});"
],
"description": "Sanitizes a value for a User name, meaning all characters except for these ASCII characters \"a-zA-Z0-9-_.@\" (not including the quotes) are removed. It also truncates the length to 50 characters. Deprecated since 2.4 uses sanitizer pageName()."
},
"options": {
"prefix": "options",
"body": [
"$${1:options;"
],
"description": "$options = array('multiLine' => false,'maxLength' => 255,'maxBytes' => 1024,'allowableTags' => '','inCharset' => 'UTF-8','outCharset' => 'UTF-8');"
},
"session->set($name, $value)": {
"prefix": "session set($name, $value)",
"body": [
"\\$${1:session}->set($${2:name}, $${3:value});"
],
"description": "Set the session variable $name to have the value $value"
},
"session->get($name)": {
"prefix": "session get($name)",
"body": [
"\\$${1:session}->get($${2:name});"
],
"description": "Get the session variable identified by the string $name"
},
"session->$name = $value": {
"prefix": "session $name = $value",
"body": [
"$${1:session}->name = value;"
],
"description": "Alternate syntax for $session->set($name, $value)"
},
"value = $session->$name": {
"prefix": "value = $session $name",
"body": [
"$${1:value = session}->name;"
],
"description": "Alternate syntax for $session->get($name)"
},
"session->getAll()": {
"prefix": "session getAll()",
"body": [
"\\$${1:session}->getAll(${2:});"
],
"description": "Return all set session variables in an array"
},
"session->remove($name)": {
"prefix": "session remove($name)",
"body": [
"\\$${1:session}->remove($${2:name});"
],
"description": "Remove/unset the session variable identified by the string $name"
},
"session->login($name, $pass)": {
"prefix": "session login($name, $pass)",
"body": [
"\\$${1:session}->login($${2:name}, $${3:pass});"
],
"description": "Login the user identified by $name and authenticated by $pass. Returns the user object on successful login or null on failure."
},
"session->logout()": {
"prefix": "session logout()",
"body": [
"\\$${1:session}->logout(${2:});"
],
"description": "Logout the current user session"
},
"session->redirect($url)": {
"prefix": "session redirect($url)",
"body": [
"\\$${1:session}->redirect($${2:url});"
],
"description": "Send an HTTP 301 (permanent) redirect to the specified URL"
},
"session->redirect($url, false)": {
"prefix": "session redirect($url, false)",
"body": [
"\\$${1:session}->redirect($${2:url}, ${3:false});"
],
"description": "Send an HTTP 302 (temporary) redirect to the specified URL"
},
"config->ajax": {
"prefix": "config ajax",
"body": [
"$${1:config}->ajax;"
],
"description": "If the current request is an ajax (asynchronous javascript) request, this is set to true."
},
"config->httpHost": {
"prefix": "config httpHost",
"body": [
"$${1:config}->httpHost;"
],
"description": "Current HTTP host name."
},
"config->https": {
"prefix": "config https",
"body": [
"$${1:config}->https;"
],
"description": "If the current request is an HTTPS request, this is set to true."
},
"config->version": {
"prefix": "config version",
"body": [
"$${1:config}->version;"
],
"description": "Current ProcessWire version string (i.e. \"2.1.0\")"
},
"config->styles": {
"prefix": "config styles",
"body": [
"$${1:config}->styles;"
],
"description": "Array used by ProcessWire admin to keep track of what stylesheet files it's template should load. It will be blank otherwise. Feel free to use it for the same purpose in your own sites."
},
"config->scripts": {
"prefix": "config scripts",
"body": [
"$${1:config}->scripts;"
],
"description": "Array used by ProcessWire admin to keep track of what javascript files it's template should load. It will be blank otherwise. Feel free to use it for the same purpose in your own sites."
},
"config->urls->root": {
"prefix": "config urls root",
"body": [
"$${1:config}->urls->root;"
],
"description": "URL to your site root (homepage) in ProcessWire."
},
"config->urls->templates": {
"prefix": "config urls templates",
"body": [
"$${1:config}->urls->templates;"
],
"description": "URL to your site templates directory."
},