Delete category picture, specified in $sField parameter

@param \OxidEsales\Eshop\Application\Model\Category $item  active category object
@param string                                       $field picture field name

@return null
770473
protected function _deleteCatPicture($item, $field)
    {
        if ($item->isDerived()) {
            return;
        }

        $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
        $sItemKey = 'oxcategories__' . $field;

        switch ($field) {
            case 'oxthumb':
                $sImgType = 'TC';
                break;

            case 'oxicon':
                $sImgType = 'CICO';
                break;

            case 'oxpromoicon':
                $sImgType = 'PICO';
                break;

            default:
                $sImgType = false;
        }

        if ($sImgType !== false) {
            /** @var \OxidEsales\Eshop\Core\UtilsPic $myUtilsPic */
            $myUtilsPic = \OxidEsales\Eshop\Core\Registry::getUtilsPic();
            /** @var \OxidEsales\Eshop\Core\UtilsFile $oUtilsFile */
            $oUtilsFile = \OxidEsales\Eshop\Core\Registry::getUtilsFile();

            $sDir = $myConfig->getPictureDir(false);
            $myUtilsPic->safePictureDelete($item->$sItemKey->value, $sDir . $oUtilsFile->getImageDirByType($sImgType), 'oxcategories', $field);

            $item->$sItemKey = new \OxidEsales\Eshop\Core\Field();
            $item->save();
        }
    }
1008678
public function removeField($field)
    {
        if (isset($this->rules[$field])) {
            unset($this->rules[$field]);
            return true;
        }
        return false;
    }
626046
public function removeItem(\Wucdbm\Bundle\MenuBuilderBundle\Entity\MenuItem $item) {
        $this->items->removeElement($item);
    }
493870
public static function setFieldValue(&$item,$field,$value,$objectFieldAccess=false)
    {
        if(is_array($item)){
            $item[$field]=$value;
        }else if(is_object($item)){
            ObjectUtil::setPropertyValue($item, $field, $value,$objectFieldAccess);
        }
    }
849668
public void removeItem(JQMListItem item) {
        if (item != null) {
            items.remove(item);
            list.remove(item);
        }
    }
128566
public function removeItem($item)
    {
        if ($item instanceof AbstractEntity) {
            $item = $item->id;
        }
        foreach ($this->value as $index => $entity) {
            if ($entity->id == $item) {
                unset($this->value[$index]);

                return;
            }
        }
    }
714513
public function delete_item($item) {
        global $DB;

        // Grab the course context.
        $context = \context_course::instance($this->_courseid, IGNORE_MISSING);

        if (!empty($context)) {
            // Delete the files.
            $fs = get_file_storage();
            $fs->delete_area_files($context->id, 'tool_recyclebin', TOOL_RECYCLEBIN_COURSE_BIN_FILEAREA, $item->id);
        } else {
            // Course context has been deleted. Find records using $item->id as this is unique for course bin recyclebin.
            $files = $DB->get_recordset('files', [
                'component' => 'tool_recyclebin',
                'filearea' => TOOL_RECYCLEBIN_COURSE_BIN_FILEAREA,
                'itemid' => $item->id,
            ]);
            $fs = get_file_storage();
            foreach ($files as $filer) {
                $file = $fs->get_file_instance($filer);
                $file->delete();
            }
            $files->close();
        }

        // Delete the record.
        $DB->delete_records('tool_recyclebin_course', array(
            'id' => $item->id
        ));

        // The course might have been deleted, check we have a context.
        $context = \context_course::instance($item->courseid, \IGNORE_MISSING);
        if (!$context) {
            return;
        }

        // Fire event.
        $event = \tool_recyclebin\event\course_bin_item_deleted::create(array(
            'objectid' => $item->id,
            'context' => $context
        ));
        $event->add_record_snapshot('tool_recyclebin_course', $item);
        $event->trigger();
    }
501200
public function BeforeDelete($item)
    {
       $contContainers = ContentContainer::Schema()->FetchByContainer(true, $item);
       $logger = new Logger(BackendModule::Guard()->GetUser());
       foreach ($contContainers as $contContainer)
       {
           $content = $contContainer->GetContent();
           $provider = ContentTreeUtil::GetTreeProvider($content);
           $tree = new TreeBuilder($provider);
           $logger->ReportContentAction($content, Action::Delete());
           $tree->Remove($provider->ItemByContent($content));
       }
    }
517288
public void removeCategory(String categoryPath) {

        m_searchObject.removeCategory(categoryPath);
        m_searchObjectChanged = true;
        ValueChangeEvent.fire(this, m_searchObject);
    }
940117
private void deselectChildren(CmsTreeItem item) {

        for (String childId : m_childrens.get(item.getId())) {
            CmsTreeItem child = m_categories.get(childId);
            deselectChildren(child);
            child.getCheckBox().setChecked(false);
            if (m_selectedCategories.contains(childId)) {
                m_selectedCategories.remove(childId);
            }
        }
    }
306287
def remove_item(self, item, field_name=None):
        
        field_name = self._choose_field_name(field_name)
        related_manager = getattr(item, field_name)
        related_manager.remove(self)
879482
public function remove(Category $category)
    {
        $category->term->delete();
        $category->delete();

        Alert::info(__('Category was removed'));

        return redirect()->route('platform.systems.category');
    }
970164
protected function removeRelationItem(JsonApiResource $entity, $field, $item)
    {
        $remover = 'remove' . ucfirst($field);

        if (!method_exists($entity, $remover)) {
            throw RestException::missingRemover($entity, $field, $remover);
        }

        return $entity->$remover($item);
    }
1089535
public function Delete($Category, $ReplacementCategoryID) {
      // Don't do anything if the required category object & properties are not defined.
      if (
         !is_object($Category)
         || !property_exists($Category, 'CategoryID')
         || !property_exists($Category, 'ParentCategoryID')
         || !property_exists($Category, 'AllowDiscussions')
         || !property_exists($Category, 'Name')
         || $Category->CategoryID <= 0
      ) {
         throw new Exception(T('Invalid category for deletion.'));
      } else {
         // Remove permissions related to category
         $PermissionModel = Gdn::PermissionModel();
         $PermissionModel->Delete(NULL, 'Category', 'CategoryID', $Category->CategoryID);
         
         // If there is a replacement category...
         if ($ReplacementCategoryID > 0) {
            // Update children categories
            $this->SQL
               ->Update('Category')
               ->Set('ParentCategoryID', $ReplacementCategoryID)
               ->Where('ParentCategoryID', $Category->CategoryID)
               ->Put();

            // Update permission categories.
            $this->SQL
               ->Update('Category')
               ->Set('PermissionCategoryID', $ReplacementCategoryID)
               ->Where('PermissionCategoryID', $Category->CategoryID)
               ->Where('CategoryID <>', $Category->CategoryID)
               ->Put();
               
            // Update discussions
            $this->SQL
               ->Update('Discussion')
               ->Set('CategoryID', $ReplacementCategoryID)
               ->Where('CategoryID', $Category->CategoryID)
               ->Put();
               
            // Update the discussion count
            $Count = $this->SQL
               ->Select('DiscussionID', 'count', 'DiscussionCount')
               ->From('Discussion')
               ->Where('CategoryID', $ReplacementCategoryID)
               ->Get()
               ->FirstRow()
               ->DiscussionCount;
               
            if (!is_numeric($Count))
               $Count = 0;
               
            $this->SQL
               ->Update('Category')->Set('CountDiscussions', $Count)
               ->Where('CategoryID', $ReplacementCategoryID)
               ->Put();
            
            // Update tags
            $this->SQL
               ->Update('Tag')
               ->Set('CategoryID', $ReplacementCategoryID)
               ->Where('CategoryID', $Category->CategoryID)
               ->Put();
            
            $this->SQL
               ->Update('TagDiscussion')
               ->Set('CategoryID', $ReplacementCategoryID)
               ->Where('CategoryID', $Category->CategoryID)
               ->Put();
         } else {
            // Delete comments in this category
            $this->SQL
               ->From('Comment c')
               ->Join('Discussion d', 'c.DiscussionID = d.DiscussionID')
               ->Where('d.CategoryID', $Category->CategoryID)
               ->Delete();
               
            // Delete discussions in this category
            $this->SQL->Delete('Discussion', array('CategoryID' => $Category->CategoryID));

            // Make inherited permission local permission
            $this->SQL
               ->Update('Category')
               ->Set('PermissionCategoryID', 0)
               ->Where('PermissionCategoryID', $Category->CategoryID)
               ->Where('CategoryID <>', $Category->CategoryID)
               ->Put();
            
            // Delete tags
            $this->SQL->Delete('Tag', array('CategoryID' => $Category->CategoryID));
            $this->SQL->Delete('TagDiscussion', array('CategoryID' => $Category->CategoryID));
         }
         
         // Delete the category
         $this->SQL->Delete('Category', array('CategoryID' => $Category->CategoryID));
      }
      // Make sure to reorganize the categories after deletes
      $this->RebuildTree();
   }
293391
private function find_item_key( $item, $field ) {
		foreach ( array( $field, $this->prefix . '_' . $field ) as $maybe_key ) {
			if ( ( is_object( $item ) && ( property_exists( $item, $maybe_key ) || isset( $item->$maybe_key ) ) ) || ( is_array( $item ) && array_key_exists( $maybe_key, $item ) ) ) {
				$key = $maybe_key;
				break;
			}
		}

		if ( ! isset( $key ) ) {
			\WP_CLI::error( "Invalid field: $field." );
		}

		return $key;
	}
933477
public function delete($text, $field = null)
    {
        $query = new Term(new IndexTerm($text, $field));
        $hits = $this->luceneIndex->find($query);
        foreach ($hits as $hit) {
            $this->luceneIndex->delete($hit);
        }
    }
1063361
public static function delete_categories($categories) {
        global $CFG, $DB;
        require_once($CFG->dirroot . "/course/lib.php");

        // Validate parameters.
        $params = self::validate_parameters(self::delete_categories_parameters(), array('categories' => $categories));

        $transaction = $DB->start_delegated_transaction();

        foreach ($params['categories'] as $category) {
            $deletecat = core_course_category::get($category['id'], MUST_EXIST);
            $context = context_coursecat::instance($deletecat->id);
            require_capability('moodle/category:manage', $context);
            self::validate_context($context);
            self::validate_context(get_category_or_system_context($deletecat->parent));

            if ($category['recursive']) {
                // If recursive was specified, then we recursively delete the category's contents.
                if ($deletecat->can_delete_full()) {
                    $deletecat->delete_full(false);
                } else {
                    throw new moodle_exception('youcannotdeletecategory', '', '', $deletecat->get_formatted_name());
                }
            } else {
                // In this situation, we don't delete the category's contents, we either move it to newparent or parent.
                // If the parent is the root, moving is not supported (because a course must always be inside a category).
                // We must move to an existing category.
                if (!empty($category['newparent'])) {
                    $newparentcat = core_course_category::get($category['newparent']);
                } else {
                    $newparentcat = core_course_category::get($deletecat->parent);
                }

                // This operation is not allowed. We must move contents to an existing category.
                if (!$newparentcat->id) {
                    throw new moodle_exception('movecatcontentstoroot');
                }

                self::validate_context(context_coursecat::instance($newparentcat->id));
                if ($deletecat->can_move_content_to($newparentcat->id)) {
                    $deletecat->delete_move($newparentcat->id, false);
                } else {
                    throw new moodle_exception('youcannotdeletecategory', '', '', $deletecat->get_formatted_name());
                }
            }
        }

        $transaction->allow_commit();
    }