Skip to content
  1. Extras
  2. userMarker

userMarker

Paid component for adding labels to resources.

Main features

  • Labels can be assigned not only to resources but to any other objects. Set your own classKey for the button
  • Context from which the resource was added is taken into account (can be disabled)
  • Output of user's labeled resources via snippet [[!userMarker.Resource? &label=`Verified`]] with the desired label
  • Managing created labels via personal cabinet
  • Access control. Assign label management rights to specific groups and contexts. Access policy template userMarker

Quick start

Script initialization

Add the snippet to the page to initialize js and css (place in the site header)

modx
[[!userMarker.Initialize]]

Label list

Insert the snippet with labels and the add-label button

modx
[[!userMarker.Label]]

Chunk for resource

example tpl.userMarker.resource.row

modx
<h3>[[+pagetitle]]</h3>
[[!userMarker.Record? &resource_id=`[[+id]]`]]

Output list of resources

Add to the page to output labeled resources

modx
[[!pdoPage?
  &element=`userMarker.Resource`
]]

[[!+page.nav]]

Or using pdoResources

modx
[[!pdoResources?
  &tpl=`tpl.userMarker.resource.row`
  &innerJoin=`{
    "Marker": {
      "class": "userMarkerResource",
      "on": "modResource.id=Marker.resource_id"
    }
  }`
]]

Output list of resources with a specific label

modx
[[!pdoPage?
  &label=`Label name`
  &element=`userMarker.Resource`
]]

[[!+page.nav]]

Managing labels

Add to the page for logged-in users.

modx
[[!userMarker.label?
  &tpl=`tpl.userMarker.manager.row`
  &tplOuter=`tpl.userMarker.manager.outer`
]]

JS overrides for modal

Custom events for the js modal

js
// Event for opening the modal
userMarker.Modal.show = function () {
  // Add your modal open script here
  $(userMarker.options.modal).modal('show');

  // Clear data after close
  $(userMarker.options.modal).on('hidden.bs.modal', function (e) {
    userMarker.removeModal();
  });
};

// Event for closing the modal
userMarker.Modal.hide = function () {
  if ($(userMarker.options.modal).length) {
    // Add your modal close script here
    $(userMarker.options.modal).modal('hide');
  }
};

Snippets

Parameters userMarker.Initialize

for loading scripts and styles

ParameterDefaultDescription
selectoruserMarkerSelector for the add-label button

Parameters userMarker.Label

userMarker snippet for outputting the label block

ParameterDefaultDescription
tplOutertpl.userMarker.outerWrapper for snippet output.
tpltpl.userMarker.rowChunk for each result row
resource_markersID of the page with labeled resources results
defaultLabelallDefault label for resource selection
user1Show only labels created by the user.

Parameters userMarker.Resource

snippet returns the list of user resources with labels

ParameterDefaultDescription
labelLabel name for user resource selection. Default all returns all resources of the logged-in user
classmodResourceClass name for selection. Default "modResource".
user_idUser ID for label output
tpltpl.userMarker.resource.rowChunk for each result row
tplOuter@INLINE [[+output]]Wrapper for snippet output.
limit10Maximum number of results
offset0Number of results to skip
sortbyidSort field. For sorting by label fields add prefix "Resource.", e.g.: "&sortby=Marker.label_id"
sortdirASCSort direction
toPlaceholderIf set, the snippet stores all data in a placeholder with this name instead of outputting.
toSeparatePlaceholdersIf you set a word in this parameter, ALL results will be put in separate placeholders starting with this word and ending with the row index (from zero). E.g. "myPl" gives [[+myPl0]], [[+myPl1]], etc.
showLogShow extra snippet debug info. Only for users logged in to the "mgr" context.
parentsComma-separated list of parent IDs for the search. By default the search is limited to the current parent. Use 0 for no limit.
resourcesComma-separated list of product IDs to include. If product id starts with minus, that product is excluded.
includeContentInclude the "content" field of products.
whereJSON-encoded string with extra conditions.
outputSeparatorOptional string to separate results.
returnIdsReturn a string of product IDs instead of formatted chunks.
showUnpublishedInclude unpublished products.
showDeletedInclude deleted products.
showHidden1Include products hidden in menu.
outerIfEmpty1Output wrapper chunk (tplOuter) even when there are no results.

Parameters userMarker.Record

snippet for the add-label button for a resource

ParameterDefaultDescription
selectoruserMarkerSelector for the add-label button
tpltpl.userMarker.recordChunk for each result row
classKeymodResourceclassKey of resource for adding the record
context_keywebResource context. Default web
resource_idResource ID to add the label to

Parameters userMarker.Colors

snippet for outputting colors in the form

ParameterDefaultDescription
label_idLabel ID for selection. Used when label name is missing
tpltpl.userMarker.colorChunk for each result row

System settings

SettingsDescription
frontend_jgrowl_jsFrontend jgrowl scripts
frontend_jgrowl_cssFrontend jgrowl styles
frontend_cssFrontend styles
frontend_jsFrontend scripts
meta_contextRegister meta context tag
regular_expressionRegular expression for label name validation
frameworkLoad framework
framework_modalModal window styles
resource_markersID of the page with labeled resources results