Skip to content

File Renaming does not change Title #33

Description

@micahsheets

I noticed that renaming a file or folder in KickAssetsAdmin changes the Name in the database but not the Title. This is a problem in the CMS when selecting a folder to insert an image from since the TinyMCE dropdown for selecting the image uses Title instead of Name. All the folders I created are listed as New-Folder still. I have fixed this by editing KickAssetAdmin.php.

public function updatefilename(SS_HTTPRequest $r) {
    if($file = DataObject::get_by_id("File", (int) $r->requestVar('fileid'))) {
        $file->setName($r->requestVar('new'));
        $file->Title = $r->requestVar('new'); // This is the new line so that Title gets updated as well.
        $file->write();
        $template = $file instanceof Folder ? "Folder" : "File";
        return $this->customise($this->getFields($file))->renderWith($template);
    }

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions