public function editCollection($args)
    {
        // Get dependencies
        $collectionMapper = ($this->container->dataMapper)('CollectionMapper');
        $json = $this->container->json;
        $toolbox = $this->container->toolbox;

        // Fetch collection group, or create new collection group
        if (isset($args['id']) && is_numeric($args['id'])) {
            $collection = $collectionMapper->findById($args['id']);
        } else {
            $definionParam = $this->request->getQueryParam('definition');

            // Validate that we have a proper definition file name
            if (null === $definionParam || 1 !== preg_match('/^[a-zA-Z0-9]+\.json$/', $definionParam)) {
                throw new Exception("PitonCMS: Invalid query parameter for 'definition': $definionParam");
            }

            // Create new collection and set template JSON file
            $collection = $collectionMapper->make();
            $collection->definition = $definionParam;
        }

        return $this->render('editCollection.html', $collection);
    }
public function editCollection($args)
    {
        // Get dependencies
        $collectionMapper = ($this->container->dataMapper)('CollectionMapper');
        $json = $this->container->json;
        $toolbox = $this->container->toolbox;

        // Fetch collection group, or create new collection group
        if (isset($args['id']) && is_numeric($args['id'])) {
            $collection = $collectionMapper->findById($args['id']);
        } else {
            $definionParam = $this->request->getQueryParam('definition');

            // Validate that we have a proper definition file name
            if (null === $definionParam || 1 !== preg_match('/^[a-zA-Z0-9]+\.json$/', $definionParam)) {
                throw new Exception("PitonCMS: Invalid query parameter for 'definition': $definionParam");
            }

            // Create new collection and set template JSON file
            $collection = $collectionMapper->make();
            $collection->definition = $definionParam;
        }

        return $this->render('editCollection.html', $collection);
    }
public function editCollection ( $ args ) { // Get dependencies $ collectionMapper = ( $ this -> container -> dataMapper ) ( 'CollectionMapper' ) ; $ json = $ this -> container -> json ; $ toolbox = $ this -> container -> toolbox ; // Fetch collection group, or create new collection group if ( isset ( $ args [ 'id' ] ) && is_numeric ( $ args [ 'id' ] ) ) { $ collection = $ collectionMapper -> findById ( $ args [ 'id' ] ) ; } else { $ definionParam = $ this -> request -> getQueryParam ( 'definition' ) ; // Validate that we have a proper definition file name if ( null === $ definionParam || 1 !== preg_match ( '/^[a-zA-Z0-9]+\.json$/' , $ definionParam ) ) { throw new Exception ( "PitonCMS: Invalid query parameter for 'definition': $definionParam" ) ; } // Create new collection and set template JSON file $ collection = $ collectionMapper -> make ( ) ; $ collection -> definition = $ definionParam ; } return $ this -> render ( 'editCollection.html' , $ collection ) ; }
Edit Collection Group

Create new collection group, or edit collection group
Edit Collection Group