original_string: public function add()
      {
          $this->loadModel('Content.ContentTypes');
          $this->loadModel('User.Roles');
          $type = $this->ContentTypes->newEntity();
  
          if ($this->request->data()) {
              $type = $this->ContentTypes->patchEntity($type, $this->request->data());
              $errors = $type->errors();
              $success = empty($errors);
  
              if ($success) {
                  $success = $this->ContentTypes->save($type);
                  if ($success) {
                      $this->Flash->success(__d('content', 'Content type created, now attach some fields.'));
                      $this->redirect(['plugin' => 'Content', 'controller' => 'fields', 'type' => $type->slug]);
                  }
              }
  
              if (!$success) {
                  $this->Flash->danger(__d('content', 'Content type could not be created, check your information.'));
              }
          }
  
          $roles = $this->Roles->find('list');
          $this->title(__d('content', 'Define New Content Type'));
          $this->set(compact('type', 'roles'));
          $this->set('languages', LocaleToolbox::languagesList());
          $this->Breadcrumb
              ->push('/admin/content/manage')
              ->push(__d('content', 'Content Types'), '/admin/content/types')
              ->push(__d('content', 'Creating Content Type'), '#');
      }
code: public function add()
      {
          $this->loadModel('Content.ContentTypes');
          $this->loadModel('User.Roles');
          $type = $this->ContentTypes->newEntity();
  
          if ($this->request->data()) {
              $type = $this->ContentTypes->patchEntity($type, $this->request->data());
              $errors = $type->errors();
              $success = empty($errors);
  
              if ($success) {
                  $success = $this->ContentTypes->save($type);
                  if ($success) {
                      $this->Flash->success(__d('content', 'Content type created, now attach some fields.'));
                      $this->redirect(['plugin' => 'Content', 'controller' => 'fields', 'type' => $type->slug]);
                  }
              }
  
              if (!$success) {
                  $this->Flash->danger(__d('content', 'Content type could not be created, check your information.'));
              }
          }
  
          $roles = $this->Roles->find('list');
          $this->title(__d('content', 'Define New Content Type'));
          $this->set(compact('type', 'roles'));
          $this->set('languages', LocaleToolbox::languagesList());
          $this->Breadcrumb
              ->push('/admin/content/manage')
              ->push(__d('content', 'Content Types'), '/admin/content/types')
              ->push(__d('content', 'Creating Content Type'), '#');
      }
code_tokens: public function add ( ) { $ this -> loadModel ( 'Content.ContentTypes' ) ; $ this -> loadModel ( 'User.Roles' ) ; $ type = $ this -> ContentTypes -> newEntity ( ) ; if ( $ this -> request -> data ( ) ) { $ type = $ this -> ContentTypes -> patchEntity ( $ type , $ this -> request -> data ( ) ) ; $ errors = $ type -> errors ( ) ; $ success = empty ( $ errors ) ; if ( $ success ) { $ success = $ this -> ContentTypes -> save ( $ type ) ; if ( $ success ) { $ this -> Flash -> success ( __d ( 'content' , 'Content type created, now attach some fields.' ) ) ; $ this -> redirect ( [ 'plugin' => 'Content' , 'controller' => 'fields' , 'type' => $ type -> slug ] ) ; } } if ( ! $ success ) { $ this -> Flash -> danger ( __d ( 'content' , 'Content type could not be created, check your information.' ) ) ; } } $ roles = $ this -> Roles -> find ( 'list' ) ; $ this -> title ( __d ( 'content' , 'Define New Content Type' ) ) ; $ this -> set ( compact ( 'type' , 'roles' ) ) ; $ this -> set ( 'languages' , LocaleToolbox :: languagesList ( ) ) ; $ this -> Breadcrumb -> push ( '/admin/content/manage' ) -> push ( __d ( 'content' , 'Content Types' ) , '/admin/content/types' ) -> push ( __d ( 'content' , 'Creating Content Type' ) , '#' ) ; }
docstring: Create new content type.
  
  @return void
docstring_tokens: Create new content type .