Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TagField doesn't render in AssetAdmin #107

Closed
andrewandante opened this issue Jan 22, 2018 · 9 comments
Closed

TagField doesn't render in AssetAdmin #107

andrewandante opened this issue Jan 22, 2018 · 9 comments

Comments

@andrewandante
Copy link

Trying to add a TagField to Image and get an empty dropdown and no ability to add new tags. I imagine that React is getting in the way - happy to take a crack at it but have no idea what direction to go in.

To reproduce:

class GalleryImageExtension extends DataExtension
{
    private static $many_many = [
        'GalleryImageTags' => GalleryImageTag::class,
    ];
}
class GalleryImageFormFactoryExtension extends Extension
{
    public function updateFormFields(FieldList $fields, $controller, $formName, $context)
    {
        $image = $context['Record'];
        $tagField = TagField::create(
            'GalleryImageTags',
            'Tags',
            GalleryImageTag::get(),
            $image->GalleryImageTags()
        );
        $fields->addFieldToTab('Editor.Details', $tagField);
    }
}
class GalleryImageTag extends DataObject
{
    private static $db = [
        'Title' => 'Varchar(50)',
    ];

    private static $belongs_many_many = [
        'GalleryImages' => Image::class,
    ];

    private static $table_name = 'GalleryImageTag';
}
SilverStripe\Assets\Image:
  extensions:
    - 'GalleryImageExtension'
SilverStripe\AssetAdmin\Forms\ImageFormFactory:
  extensions:
    - 'GalleryImageFormFactoryExtension'
@tractorcow
Copy link
Contributor

Ah yes, someone needs to build a react tagfield. :) It'll be a nice major job for someone, but we will probably do it at some point before 5.x.

@andrewandante
Copy link
Author

AFAICT there's no multi-select fields built in React at the moment - is there a method of adding a non-reacty field into the React CompositeField nicely?

For now I will use a TextField with a delimiter :)

@tractorcow
Copy link
Contributor

AFAICT there's no multi-select fields built in React at the moment -

We built tree multi select field. ;)

is there a method of adding a non-reacty field into the React CompositeField nicely?

Absolutely not. ;P

@tractorcow
Copy link
Contributor

Also see https://app.zenhub.com/workspace/o/silverstripe/silverstripe-admin/issues/52

@robbieaverill
Copy link
Contributor

We fixed this recently with #110

@wilr
Copy link
Member

wilr commented Sep 20, 2018

@robbieaverill Just tried to add a TagField to AssetAdmin and it errors - Attempted to update component t[AssetAdmin.EditForm] that has already been unmounted (or failed to mount).

@robbieaverill
Copy link
Contributor

Oh damn!

@robbieaverill robbieaverill reopened this Sep 20, 2018
@wilr
Copy link
Member

wilr commented Oct 10, 2018

PR at #120

@robbieaverill
Copy link
Contributor

Will be fixed in the next minor release of tagfield

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants