To participate you must create an account on apostrophenow.org. If you have already done so, click Login.

Ticket #229: sluggify-patch.patch

File sluggify-patch.patch, 1.7 KB (added by fotakis, 2 years ago)

This is a patch to extract the slugify method from the executeCreate action

  • apps/frontend/config/app.yml

    # This patch file was generated by NetBeans IDE
    # Following Index: paths are relative to: /opt/apostrophe/1.3
    # This patch can be applied using context Tools: Patch action on respective folder.
    # It uses platform neutral UTF-8 encoding and \n newlines.
    # Above lines and this line are ignored by the patching process.
     
    11# default values 
    22all: 
    33  a: 
     4    slugger_class:  aSluggifier 
    45    # If true, there will be a language switcher next to the login/logout button 
    56    i18n_switch: true 
    67    i18n_languages: [en, fr, de, es] 
  • plugins/apostrophePlugin/lib/action/BaseaActions.class.php

     
    201201    $title = trim($this->getRequestParameter('title')); 
    202202    $this->flunkUnless(strlen($title)); 
    203203 
    204     $pathComponent = $title; 
    205     $pathComponent = strtolower(preg_replace("/[\W]+/", "-", $title)); 
     204    $slugger = sfConfig::get('app_a_slugger_class'); 
     205        $pathComponent = $slugger::sluggify($title,aTools::getUserCulture()); 
    206206 
    207207    $base = $parent->getSlug(); 
    208208    if ($base === '/') 
  • plugins/apostrophePlugin/lib/slugger/aSluggifier.class.php

     
     1class aSluggifier{ 
     2         
     3        public static function sluggify($text, $culture="en"){ 
     4                return strtolower(preg_replace("/[\W]+/", "-", $title)); 
     5        } 
     6 
     7} 
     8 No newline at end of file