Results 1 to 6 of 6

Thread: How to generate news alias with hidden field?

  1. #1
    User
    Join Date
    11-24-13.
    Posts
    44

    Idee How to generate news alias with hidden field?

    Hi all!
    I have an usergroup that can insert news with only a subset of fields. I want to hide to users the field 'alias' but I want that the alias is generated automatically.

    Is it possible? How?

    Thank you!

    Davide

  2. #2
    User MacKP's Avatar
    Join Date
    06-19-09.
    Location
    Duisburg (Germany)
    Posts
    211

    Default

    Hi DavideR,
    that is not possible at the moment. Contao can just handle visible fields...

    regards
    Mediendepot Ruhr
    For real-time chat the (inofficial) Chatroom in IRC:
    -> irc.freenode.net #contao | irc.freenode.net #contao.de

  3. #3
    User Andreas's Avatar
    Join Date
    07-11-09.
    Location
    Mönchengladbach
    Posts
    499

    Default

    Ein Workaround wäre noch, das Feld für Nichtadmins per CSS zu verstecken.
    PHP Code:
    // system/config/dcaconfig.php
    if(!BackendUser::getInstance()->isAdmin)
    {
      
    $GLOBALS['TL_DCA']['tl_news']['fields']['alias']['eval']['style'] = 'display:none;';

    Oder mit eigenem CSS für Nichtadmins.
    PHP Code:
    // system/config/dcaconfig.php
    if(TL_MODE == 'BE' && !BackendUser::getInstance()->isAdmin)
    {
      
    $GLOBALS['TL_CSS'][] = 'files/css/_my_be.css';

    Web-Development, Freelancer, Burgtech, XHTML, HTML5, CSS, PHP, Javascript, MooTools, MySQL and more
    Amazon wishlist

  4. #4
    User Spooky's Avatar
    Join Date
    01-03-13.
    Posts
    339

    Default

    Or just disable it:
    PHP Code:
    if(!\BackendUser::getInstance()->isAdmin)
    {
      
    $GLOBALS['TL_DCA']['tl_news']['fields']['alias']['eval']['disabled'] = true;


  5. #5
    User Andreas's Avatar
    Join Date
    07-11-09.
    Location
    Mönchengladbach
    Posts
    499

    Default

    Quote Originally Posted by Spooky View Post
    Or just disable it
    Ja, ich hatte kurz darauf auch ein Ticket gesehen, evtl. sogar von dir, wo gesagt wird, dass es mit disabled geht. War da nicht mal ne lange Diskussion, dass readonly und disabled von Contao gleich behandelt werden und die Felder dann nicht mehr funktionieren? Aber wenn's funktioniert, würde ich das auf jeden Fall auch vorschlagen.
    Web-Development, Freelancer, Burgtech, XHTML, HTML5, CSS, PHP, Javascript, MooTools, MySQL and more
    Amazon wishlist

  6. #6
    User Spooky's Avatar
    Join Date
    01-03-13.
    Posts
    339

    Default

    Doch funktioniert, laut meinem Test in dem Issue zumindest. Mit dem disabled field wird der Alias bei nicht vorhanden sein automatisch generiert und kann natürlich vom Benutzer nicht verändert werden.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •