This function shows the view to create a new category.
970544
def new
      core__set_header_active_page_title(LANGUAGES[:lato_blog][:pages][:categories_new])
      @category = LatoBlog::Category.new

      if params[:language]
        set_current_language params[:language]
      end

      if params[:parent]
        @category_parent = LatoBlog::CategoryParent.find_by(id: params[:parent])
      end

      fetch_external_objects
    end
922891
def get_new_category(self, api_category):
        
        return Category(site_id=self.site_id,
                        wp_id=api_category["ID"],
                        **self.api_object_data("category", api_category))
624705
public function make(ICategory $category)
    {
        //$category->setResponse($this->response->view('admin.categorys.view', compact('category')));
        $category->setResponse($this->response->view(\OogleeBConfig::get('config.category_view.view'), compact('category')));
    }
231209
public function create()
    {
        $this->authorize(PostsPolicy::PERMISSION_CREATE);

        $categories = Category::getSelectData();
        $tags       = Tag::getSelectData();
        $statuses   = Post::getStatuses();

        $this->setTitle($title = trans('blog::posts.titles.create-post'));
        $this->addBreadcrumb($title);

        return $this->view('admin.posts.create', compact('categories', 'tags', 'statuses'));
    }
584840
public function create() {
        $categories = $this->repository->getAll();

        return view('lasallecmsadmin::'.config('lasallecmsadmin.admin_template_name').'/categories/create',[
            'pagetitle'                      => 'Categories',
            'field_list'                     => $this->model->field_list,
            'namespace_formprocessor'        => $this->model->namespace_formprocessor,
            'classname_formprocessor_create' => $this->model->classname_formprocessor_create,
            'DatesHelper'                    => DatesHelper::class,
            'Form'                           => Form::class,
            'HTMLHelper'                     => HTMLHelper::class,
            'categories'                     => $categories,
            'admin_size_input_text_box'      => Config::get('lasallecmsadmin.admin_size_input_text_box'),
        ]);
    }
679675
public function add_category($newparent, $newcategory, $newinfo, $return = false, $newinfoformat = FORMAT_HTML,
            $idnumber = null) {
        global $DB;
        if (empty($newcategory)) {
            print_error('categorynamecantbeblank', 'question');
        }
        list($parentid, $contextid) = explode(',', $newparent);
        //moodle_form makes sure select element output is legal no need for further cleaning
        require_capability('moodle/question:managecategory', context::instance_by_id($contextid));

        if ($parentid) {
            if(!($DB->get_field('question_categories', 'contextid', array('id' => $parentid)) == $contextid)) {
                print_error('cannotinsertquestioncatecontext', 'question', '', array('cat'=>$newcategory, 'ctx'=>$contextid));
            }
        }

        if ((string) $idnumber === '') {
            $idnumber = null;
        } else if (!empty($contextid)) {
            // While this check already exists in the form validation, this is a backstop preventing unnecessary errors.
            if ($DB->record_exists('question_categories',
                    ['idnumber' => $idnumber, 'contextid' => $contextid])) {
                $idnumber = null;
            }
        }

        $cat = new stdClass();
        $cat->parent = $parentid;
        $cat->contextid = $contextid;
        $cat->name = $newcategory;
        $cat->info = $newinfo;
        $cat->infoformat = $newinfoformat;
        $cat->sortorder = 999;
        $cat->stamp = make_unique_id_code();
        if ($idnumber) {
            $cat->idnumber = $idnumber;
        }
        $categoryid = $DB->insert_record("question_categories", $cat);

        // Log the creation of this category.
        $category = new stdClass();
        $category->id = $categoryid;
        $category->contextid = $contextid;
        $event = \core\event\question_category_created::create_from_question_category_instance($category);
        $event->trigger();

        if ($return) {
            return $categoryid;
        } else {
            redirect($this->pageurl);//always redirect after successful action
        }
    }
1273388
def help_center_category_translation_create(self, category_id, data, **kwargs):
        ""
        api_path = "/api/v2/help_center/categories/{category_id}/translations.json"
        api_path = api_path.format(category_id=category_id)
        return self.call(api_path, method="POST", data=data, **kwargs)
1346020
def add_category
      category_name = self.name.to_s.split('.').first
      # if one word then add to general category
      category_name = self.name.to_s.split('.').size == 1 ? 'general' : self.name.to_s.split('.').first
      self.category = TranslationCenter::Category.where(name: category_name).first_or_create
      self.last_accessed = Time.now
    end
1024684
public function DiscussionsController_MarkCategoryViewed_Create($Sender, $CategoryID) {
		if (strlen($CategoryID) > 0 && (int)$CategoryID > 0) {
         $CategoryModel = new CategoryModel();
			$this->MarkCategoryRead($CategoryModel, $CategoryID);
			$this->RecursiveMarkCategoryRead($CategoryModel, CategoryModel::Categories(), array($CategoryID));
		}
      
		Redirect(Gdn::Request()->GetValueFrom(Gdn_Request::INPUT_SERVER, 'HTTP_REFERER'));
	}
284107
def new_category(blog_id, username, password, category_struct):
    
    authenticate(username, password, 'zinnia.add_category')
    category_dict = {'title': category_struct['name'],
                     'description': category_struct['description'],
                     'slug': category_struct['slug']}
    if int(category_struct['parent_id']):
        category_dict['parent'] = Category.objects.get(
            pk=category_struct['parent_id'])
    category = Category.objects.create(**category_dict)

    return category.pk
380009
def draw_categories(self):
        """"""
        for label in self._category_labels.values():
            label.destroy()
        self._category_labels.clear()
        canvas_width = 0
        for category in (sorted(self._categories.keys() if isinstance(self._categories, dict) else self._categories)
                         if not isinstance(self._categories, OrderedDict)
                         else self._categories):
            kwargs = self._categories[category] if isinstance(self._categories, dict) else {"text": category}
            kwargs["background"] = kwargs.get("background", self._background)
            kwargs["justify"] = kwargs.get("justify", tk.LEFT)
            label = ttk.Label(self._frame_categories, **kwargs)
            width = label.winfo_reqwidth()
            canvas_width = width if width > canvas_width else canvas_width
            self._category_labels[category] = label
        self._canvas_categories.create_window(0, 0, window=self._frame_categories, anchor=tk.NW)
        self._canvas_categories.config(width=canvas_width + 5, height=self._height)
918746
public function create()
    {
        $categorias = $this->categoriaRepo->listPub();
        $tags = $this->tagRepo->listPub();

        return view('admin.noticias.create', compact('categorias','tags'));
    }
584728
public function newAction()
    {
        $settings = $this->settingsService->get();
        $backendLayouts = $this->backendLayoutRepository->findAll(explode(",", $settings['backendlayout_pids']));
        $this->view->assign('backendLayouts', $backendLayouts);
    }
869806
def help_center_category_create(self, data, locale=None, **kwargs):
        ""
        api_path = "/api/v2/help_center/categories.json"
        if locale:
            api_opt_path = "/api/v2/help_center/{locale}/categories.json"
            api_path = api_opt_path.format(locale=locale)
        return self.call(api_path, method="POST", data=data, **kwargs)
836712
def category(self, categories):
        
        if isinstance(categories, list):
            for c in categories:
                self.add_category(c)
        else:
            self.add_category(categories)
276883
def on_add(self, item):
        """"""
        super(Tels, self).on_add(list_views.PseudoAccesCategorie(item))
1344008
def create(self, parent_id, data, store_view=None):
        
        return int(self.call(
            'catalog_category.create', [parent_id, data, store_view])
        )