Code Monkey home page Code Monkey logo

archivist's Introduction

PunktDe.Archivist

Travis Build Status Latest Stable Version Total Downloads

Purpose of this package: Automatically sorts nodes into a predefined structure which is created on the fly.

Neos has some drawbacks, if you store lots of Node - like news for example - on the same hierarchical level. Especially the backend trees are getting slow and confusing. This package automatically sorts this nodes in a configured and automatically created hierarchy.

Configuration

You can configure the behavior differently for every triggering node type. The configuration options are best explained by example. These examples are taken from Configuration/Testing/Settings.yaml and are thus automatically tested.

Simple Example

Configuration for the nodeType 'PunktDe.Archivist.TriggerNode'. The sorting is triggered if a node of this type is created or if a property on this node is changed. This node is then available as 'node' in the other parts of the configuration

PunktDe: Archivist: sortingInstructions:

  'PunktDe.Archivist.TriggerNode':

    # The query selecting the root node of the automatically created hierarchy
    hierarchyRoot: "${q(site).find('[instanceof Neos.ContentRepository.Testing:Page]').get(0)}"

    # Optional: The sorting of the nodes inside the target hierarchy. Can be the name of a property
    # or an eel expression like seen below
    sorting: title

    # Optional: Trigger sorting only, when condition is met. Can be used to make sure that required properties are set as expected.
    condition: "${node.properties.date != null}"

    # In the context is evaluated first. You can define variables here which you can use in
    # the remaining configuration
    context:
      publishDate: "${node.properties.date}"

    # Automatically publish the created document hierarchy
    publishHierarchy: true

    # Definition of the auto-generated hierarchy
    hierarchy:
      -
        # The type of the hierarchy-node
        type: 'PunktDe.Archivist.HierarchyNode'

        # Properties of the new created node.
        properties:
          name: "${Date.year(publishDate)}"
          title: "${Date.year(publishDate)}"
          hiddenInIndex: "${true}"

        # The property which is identical throughout all nodes of this level
        identity: title

        # An eel query that describes the sorting condition
        sorting: "${q(a).property('title') < q(b).property('title')}"
      -
        type: 'PunktDe.Archivist.HierarchyNode'
        properties:
          name: "${Date.month(publishDate)}"
          title: "${Date.month(publishDate)}"
        identity: title

        # Simple sorting on a property
        sorting: title

Example with a triggering content node

A content node triggers the move of its parent document node. For example, if you have a title node which should be considered to move the page.

PunktDe:
  Archivist:
    sortingInstructions:
      'PunktDe.Archivist.TriggerContentNode':

        # The query selecting the root node of the automatically created hierarchy
        hierarchyRoot: "${q(site).find('[instanceof Neos.ContentRepository.Testing:Page]').get(0)}"

        # Optional: The node to be moved, described by an Eel query.
        # This defaults to the triggering node if not set. The triggering node is available as "node".
        # If the affected node is not found by the operation is skipped.
        # This can for example be used if a change in a content node should move its parent document node
        #
        affectedNode: "${q(node).parent('[instanceof Neos.ContentRepository.Testing:Document]').get(0)}"

        # Definition of the auto-generated hierarchy
        hierarchy:
          -
            # The type of the hierarchy-node
            type: 'PunktDe.Archivist.HierarchyNode'

            # Properties of the new created node.
            properties:
              name: "${Archivist.buildSortingCharacter(title)}"
              title: "${Archivist.buildSortingCharacter(title)}"

Define multiple configurations for the same NodeType

In addition to

PunktDe:
  Archivist:
    sortingInstructions:
      MyNode.Type:
        hierarchyRoot: # ...

you can now do this:

PunktDe:
  Archivist:
    sortingInstructions:
      MyNode.Type:
        foo1:
          hierarchyRoot:  # ...
        foo2:
          hierarchyRoot:  # ...

Make sure, to define a conditon to not run several configurations on the same Node action.

Archivist Eel Helper

Archivist.buildSortingCharacter(string, position = 0, length = 1) Generates upper case sorting characters from the given string. Starting position and length can be defined.

archivist's People

Contributors

andrehoffmann30 avatar daniellienert avatar fnkr avatar freund0 avatar haase-fabian avatar jonnitto avatar skurfuerst avatar thedex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

archivist's Issues

BUG: cant copy document node to another content dimension

What I did

  1. Select a document node
  2. Copy it via the content dimensions switch to another dimension
  3. Error displayed and document node isnt fully copied

Additional Informations/Versions

Neos: 5.1.5
Flow: 6.1.3
Archivist: >=2.3.0

The Node 174f66f8-0082-465d-9d3a-fe5071956907 exists in both content dimenions.

Exepction log

Exception #1332491864 in line 213 of /Users/xy/Projects/xy/Data/Temporary/Development/SubContextValet/Cache/Code/Flow_Object_Classes/Neos_Eel_FlowQuery_FlowQuery.php: No operation which satisfies the runtime constraints found for "find".

46 Neos\Eel\FlowQuery\OperationResolver_Original::resolveOperation("find", array|1|)
45 Neos\Eel\FlowQuery\FlowQuery_Original::evaluateOperations()
44 Neos\Eel\FlowQuery\FlowQuery_Original::__call("get", array|1|)
43 call_user_func_array(array|2|, array|1|)
42 Neos\Eel\Context::call("get", array|1|)
41 Neos\Eel\ProtectedContext::call("get", array|1|)
40 Neos\Eel\Context::callAndWrap("get", array|1|)
39 Neos\Eel\CompilingEvaluator_Original::{closure}(Neos\Eel\ProtectedContext)
38 Neos\Eel\CompilingEvaluator_Original::evaluateAndUnwrap(Closure, Neos\Eel\ProtectedContext)
37 Neos\Eel\CompilingEvaluator_Original::evaluate("q(site).find('#174f66f8-0082-465d-9d3a-fe5071956907').get(0)", Neos\Eel\ProtectedContext)
36 Neos\Eel\Utility_Original::evaluateEelExpression("${q(site).find('#174f66f8-0082-465d-9d3a-fe5071956907').get(0)}", Neos\Eel\CompilingEvaluator, array|30|, array|43|)
35 PunktDe\Archivist\Service\EelEvaluationService_Original::evaluate("${q(site).find('#174f66f8-0082-465d-9d3a-fe5071956907').get(0)}", array|3|)
34 PunktDe\Archivist\Service\EelEvaluationService_Original::evaluateIfValidEelExpression("${q(site).find('#174f66f8-0082-465d-9d3a-fe5071956907').get(0)}", array|3|)
33 PunktDe\Archivist\Archivist_Original::buildBaseContext(Neos\ContentRepository\Domain\Model\Node, array|5|)
32 PunktDe\Archivist\Archivist_Original::organizeNode(Neos\ContentRepository\Domain\Model\Node, array|5|)
31 PunktDe\Archivist\NodeSignalInterceptor_Original::nodeAdded(Neos\ContentRepository\Domain\Model\Node, "Neos\ContentRepository\Domain\Model\Node::nodeAdded")
30 call_user_func_array(array|2|, array|2|)
29 Neos\Flow\SignalSlot\Dispatcher::dispatch("Neos\ContentRepository\Domain\Model\Node", "nodeAdded", array|1|)
28 Neos\Flow\SignalSlot\SignalAspect_Original::forwardSignalToDispatcher(Neos\Flow\Aop\JoinPoint)
27 Neos\Flow\Aop\Advice\AbstractAdvice::invoke(Neos\Flow\Aop\JoinPoint)
26 Neos\ContentRepository\Domain\Model\Node::emitNodeAdded(Neos\ContentRepository\Domain\Model\Node)
25 Neos\ContentRepository\Domain\Model\Node_Original::createVariantForContext(Neos\Neos\Domain\Service\ContentContext)
24 Neos\ContentRepository\Domain\Service\Context_Original::adoptNode(Neos\ContentRepository\Domain\Model\Node, true)
23 Neos\Neos\Controller\Service\NodesController_Original::adoptNodeAndParents(Neos\ContentRepository\Domain\Model\Node, Neos\Neos\Domain\Service\ContentContext, true)
22 Neos\Neos\Controller\Service\NodesController_Original::createAction("adoptFromAnotherDimensionAndCopyContent", "89214cc4-b34c-4135-b417-4e5b8e5aac9c", "user-admin", array|1|, array|1|)
21 Neos\Neos\Controller\Service\NodesController::createAction("adoptFromAnotherDimensionAndCopyContent", "89214cc4-b34c-4135-b417-4e5b8e5aac9c", "user-admin", array|1|, array|1|)
20 call_user_func_array(array|2|, array|5|)
19 Neos\Neos\Controller\Service\NodesController::Flow_Aop_Proxy_invokeJoinPoint(Neos\Flow\Aop\JoinPoint)
18 Neos\Flow\Aop\Advice\AdviceChain::proceed(Neos\Flow\Aop\JoinPoint)
17 Neos\Flow\Security\Aspect\PolicyEnforcementAspect_Original::enforcePolicy(Neos\Flow\Aop\JoinPoint)
16 Neos\Flow\Aop\Advice\AroundAdvice::invoke(Neos\Flow\Aop\JoinPoint)
15 Neos\Flow\Aop\Advice\AdviceChain::proceed(Neos\Flow\Aop\JoinPoint)
14 Neos\Neos\Controller\Service\NodesController::createAction("adoptFromAnotherDimensionAndCopyContent", "89214cc4-b34c-4135-b417-4e5b8e5aac9c", "user-admin", array|1|, array|1|)
13 call_user_func_array(array|2|, array|5|)
12 Neos\Flow\Mvc\Controller\ActionController_Original::callActionMethod()
11 Neos\Flow\Mvc\Controller\ActionController_Original::processRequest(Neos\Flow\Mvc\ActionRequest, Neos\Flow\Mvc\ActionResponse)
10 Neos\Flow\Mvc\Dispatcher_Original::initiateDispatchLoop(Neos\Flow\Mvc\ActionRequest, Neos\Flow\Mvc\ActionResponse)
9 Neos\Flow\Mvc\Dispatcher_Original::dispatch(Neos\Flow\Mvc\ActionRequest, Neos\Flow\Mvc\ActionResponse)
8 call_user_func_array(array|2|, array|2|)
7 Neos\Flow\ObjectManagement\DependencyInjection\DependencyProxy::__call("dispatch", array|2|)
6 Neos\Flow\Mvc\DispatchComponent_Original::handle(Neos\Flow\Http\Component\ComponentContext)
5 Neos\Flow\Http\Component\ComponentChain_Original::handle(Neos\Flow\Http\Component\ComponentContext)
4 Neos\Flow\Http\Component\ComponentChain_Original::handle(Neos\Flow\Http\Component\ComponentContext)
3 Neos\Flow\Http\RequestHandler::handleRequest()
2 Neos\Flow\Core\Bootstrap::run()
1 require("/Users/xy/Projects/xy/Web/index.php")

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.