original_string: protected function _createSortFieldOption($field, $dir, $options)
      {
          $sortField = $this->sortFields[$field];
          if (isset($sortField['custom'])) {
              if (!is_array($sortField['custom'])) {
                  $sortField['custom'] = [$sortField['custom']];
              }
              foreach ($sortField['custom'] as $sortEntry) {
                  $options['order'][] = preg_replace('/:dir/', $dir, $sortEntry);
              }
          } else {
              $options['order'][] = $sortField['modelField'] . ' ' . $dir;
          }
  
          return $options;
      }
code: protected function _createSortFieldOption($field, $dir, $options)
      {
          $sortField = $this->sortFields[$field];
          if (isset($sortField['custom'])) {
              if (!is_array($sortField['custom'])) {
                  $sortField['custom'] = [$sortField['custom']];
              }
              foreach ($sortField['custom'] as $sortEntry) {
                  $options['order'][] = preg_replace('/:dir/', $dir, $sortEntry);
              }
          } else {
              $options['order'][] = $sortField['modelField'] . ' ' . $dir;
          }
  
          return $options;
      }
code_tokens: protected function _createSortFieldOption ( $ field , $ dir , $ options ) { $ sortField = $ this -> sortFields [ $ field ] ; if ( isset ( $ sortField [ 'custom' ] ) ) { if ( ! is_array ( $ sortField [ 'custom' ] ) ) { $ sortField [ 'custom' ] = [ $ sortField [ 'custom' ] ] ; } foreach ( $ sortField [ 'custom' ] as $ sortEntry ) { $ options [ 'order' ] [ ] = preg_replace ( '/:dir/' , $ dir , $ sortEntry ) ; } } else { $ options [ 'order' ] [ ] = $ sortField [ 'modelField' ] . ' ' . $ dir ; } return $ options ; }
docstring: Create the 'order' find condition part for a sorted field.
  
  @param string $field The field name to sort
  @param string $dir The sort direction (asc, desc)
  @param array $options The current find options where the sorting should be added.
  @return mixed
docstring_tokens: Create the order find condition part for a sorted field .