Giter Club home page Giter Club logo

selector's Introduction

Selector

custom TV to replace mm_ddSelectDocuments Based on Tokenize

Selector allows to choose documents from dropdown list and save their ids in TV.

You can modify it via config files and custom controllers.

Config file contains an array with some Tokenize options and token template:

<?php
return array(
    'maxElements'        => 0,
    'nbDropdownElements' => 10,
    'searchMaxLength'    => 30,
    'searchMinLength'    => 0,
    'textField'          => 'text',
    'valueField'         => 'id',
    'htmlField'          => 'html',
    'tokenConfig'        => array(
        'tpl' => '@CODE: <option value="[+id+]" selected>[+id+]. [+pagetitle+]</option>'
    )
);

If your TV's name is "related" then config file is "assets/tvs/selector/config/related.php".

With custom controllers you can modify the dropdown list data. For TV named "related" you should create "assets/tvs/selector/lib/related.controller.class.php" file (for autoload with Selector; if you want to use arbitrary file name and location then load class file manually with OnManagerPageInit plugin) with controller class that extends \Selector\SelectorController in it:

<?php namespace Selector;
include_once(MODX_BASE_PATH.'assets/tvs/selector/lib/controller.class.php');
class RelatedController extends SelectorController {
    public function __construct($modx) {
        parent::__construct($modx);
        $this->dlParams['parents'] = 5;
        $this->dlParams['addWhereList'] = 'c.published = 1';
    }
}

Pay attention that class name is "RelatedController".

Request to the controller contains the following data in $_REQUEST:

  • doc_id - document id (0 for new documents);
  • doc_parent - document parent id;
  • doc_template - document template id;
  • tvid - TV id;
  • tvname - TV name;
  • search - query string.

Selector is discussed here

selector's People

Contributors

pathologic avatar aharito avatar ego7000 avatar dzhuryn avatar

Watchers

James Cloos avatar D.Tsombolov avatar

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.