original_string: public function viewModeList($viewMode)
      {
          $this->_validateViewMode($viewMode);
          $this->loadModel('Field.FieldInstances');
          $instances = $this->_getInstances();
  
          if (count($instances) === 0) {
              $this->Flash->warning(__d('field', 'There are no field attached yet.'));
          } else {
              $instances = $instances->sortBy(function ($fieldInstance) use ($viewMode) {
                  if (isset($fieldInstance->view_modes[$viewMode]['ordering'])) {
                      return $fieldInstance->view_modes[$viewMode]['ordering'];
                  }
  
                  return 0;
              }, SORT_ASC);
          }
  
          $this->title(__d('field', 'View Modes'));
          $this->set('instances', $instances);
          $this->set('viewMode', $viewMode);
          $this->set('viewModeInfo', $this->viewModes($viewMode));
      }
code: public function viewModeList($viewMode)
      {
          $this->_validateViewMode($viewMode);
          $this->loadModel('Field.FieldInstances');
          $instances = $this->_getInstances();
  
          if (count($instances) === 0) {
              $this->Flash->warning(__d('field', 'There are no field attached yet.'));
          } else {
              $instances = $instances->sortBy(function ($fieldInstance) use ($viewMode) {
                  if (isset($fieldInstance->view_modes[$viewMode]['ordering'])) {
                      return $fieldInstance->view_modes[$viewMode]['ordering'];
                  }
  
                  return 0;
              }, SORT_ASC);
          }
  
          $this->title(__d('field', 'View Modes'));
          $this->set('instances', $instances);
          $this->set('viewMode', $viewMode);
          $this->set('viewModeInfo', $this->viewModes($viewMode));
      }
code_tokens: public function viewModeList ( $ viewMode ) { $ this -> _validateViewMode ( $ viewMode ) ; $ this -> loadModel ( 'Field.FieldInstances' ) ; $ instances = $ this -> _getInstances ( ) ; if ( count ( $ instances ) === 0 ) { $ this -> Flash -> warning ( __d ( 'field' , 'There are no field attached yet.' ) ) ; } else { $ instances = $ instances -> sortBy ( function ( $ fieldInstance ) use ( $ viewMode ) { if ( isset ( $ fieldInstance -> view_modes [ $ viewMode ] [ 'ordering' ] ) ) { return $ fieldInstance -> view_modes [ $ viewMode ] [ 'ordering' ] ; } return 0 ; } , SORT_ASC ) ; } $ this -> title ( __d ( 'field' , 'View Modes' ) ) ; $ this -> set ( 'instances' , $ instances ) ; $ this -> set ( 'viewMode' , $ viewMode ) ; $ this -> set ( 'viewModeInfo' , $ this -> viewModes ( $ viewMode ) ) ; }
docstring: View modes.
  
  Shows the list of fields for corresponding view mode.
  
  @param string $viewMode View mode slug. e.g. `rss` or `default`
  @return void
  @throws \Cake\Network\Exception\NotFoundException When given view mode
  does not exists
docstring_tokens: View modes .