original_string: public static function save_category(category_controller $category) {
          $isnewcategory = empty($category->get('id'));
  
          $category->save();
  
          if ($isnewcategory) {
              // Move to the end.
              self::move_category($category);
              category_created::create_from_object($category)->trigger();
          } else {
              category_updated::create_from_object($category)->trigger();
          }
      }
code: public static function save_category(category_controller $category) {
          $isnewcategory = empty($category->get('id'));
  
          $category->save();
  
          if ($isnewcategory) {
              // Move to the end.
              self::move_category($category);
              category_created::create_from_object($category)->trigger();
          } else {
              category_updated::create_from_object($category)->trigger();
          }
      }
code_tokens: public static function save_category ( category_controller $ category ) { $ isnewcategory = empty ( $ category -> get ( 'id' ) ) ; $ category -> save ( ) ; if ( $ isnewcategory ) { // Move to the end. self :: move_category ( $ category ) ; category_created :: create_from_object ( $ category ) -> trigger ( ) ; } else { category_updated :: create_from_object ( $ category ) -> trigger ( ) ; } }
docstring: Insert or update custom field category
  
  @param category_controller $category
docstring_tokens: Insert or update custom field category