original_string: public function generate($pattern, array $options = array())
      {
          $options += array(
              'translit' => true,
              'language' => null,
              'placeholders' => array()
          );
  
          $result = null;
          $this->hook->attach('alias.generate.before', $pattern, $options, $result);
  
          if (isset($result)) {
              return (string) $result;
          }
  
          $alias = $pattern;
          if (!empty($options['placeholders'])) {
              $alias = gplcart_string_replace($pattern, $options['placeholders'], $options);
          }
  
          if (!empty($options['translit'])) {
              $alias = gplcart_string_slug($this->language->translit($alias, $options['language']));
          }
  
          $trimmed = mb_strimwidth(str_replace(' ', '-', trim($alias)), 0, 100, '');
          $result = $this->getUnique($trimmed);
          $this->hook->attach('alias.generate.after', $pattern, $options, $result);
          return $result;
      }
code: public function generate($pattern, array $options = array())
      {
          $options += array(
              'translit' => true,
              'language' => null,
              'placeholders' => array()
          );
  
          $result = null;
          $this->hook->attach('alias.generate.before', $pattern, $options, $result);
  
          if (isset($result)) {
              return (string) $result;
          }
  
          $alias = $pattern;
          if (!empty($options['placeholders'])) {
              $alias = gplcart_string_replace($pattern, $options['placeholders'], $options);
          }
  
          if (!empty($options['translit'])) {
              $alias = gplcart_string_slug($this->language->translit($alias, $options['language']));
          }
  
          $trimmed = mb_strimwidth(str_replace(' ', '-', trim($alias)), 0, 100, '');
          $result = $this->getUnique($trimmed);
          $this->hook->attach('alias.generate.after', $pattern, $options, $result);
          return $result;
      }
code_tokens: public function generate ( $ pattern , array $ options = array ( ) ) { $ options += array ( 'translit' => true , 'language' => null , 'placeholders' => array ( ) ) ; $ result = null ; $ this -> hook -> attach ( 'alias.generate.before' , $ pattern , $ options , $ result ) ; if ( isset ( $ result ) ) { return ( string ) $ result ; } $ alias = $ pattern ; if ( ! empty ( $ options [ 'placeholders' ] ) ) { $ alias = gplcart_string_replace ( $ pattern , $ options [ 'placeholders' ] , $ options ) ; } if ( ! empty ( $ options [ 'translit' ] ) ) { $ alias = gplcart_string_slug ( $ this -> language -> translit ( $ alias , $ options [ 'language' ] ) ) ; } $ trimmed = mb_strimwidth ( str_replace ( ' ' , '-' , trim ( $ alias ) ) , 0 , 100 , '' ) ; $ result = $ this -> getUnique ( $ trimmed ) ; $ this -> hook -> attach ( 'alias.generate.after' , $ pattern , $ options , $ result ) ; return $ result ; }
docstring: Generate a URL alias using a pattern and an array of data
  @param string $pattern
  @param array $options
  @return string
docstring_tokens: Generate a URL alias using a pattern and an array of data