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

[Bug] some page_or_link field values are not being stored in db when used inside a repeatable #3704

Open
valerinakov opened this issue May 5, 2021 · 3 comments
Assignees
Labels
Possible Bug A bug that was reported but not confirmed yet. Priority: COULD Priority: SHOULD

Comments

@valerinakov
Copy link

valerinakov commented May 5, 2021

Bug report

What I did

I have a repeatable field with a page_or_link field inside it. The data from it is stored in a fake extras db as json.

$this->crud->addField([
    'name' => 'name',
    'label' => 'label',
    'type' => 'repeatable',
    'fields' => [
        [   
            'name'       => ['type', 'link', 'page_id'],
            'label'      => "Type",
            'type'       => 'page_or_link',
            'page_model' => '\Backpack\PageManager\app\Models\Page'
        ],
    ],
    'min_rows' => 1,
    'fake' => true,
    'store_in' => 'extras'
]);

What I expected to happen

I expected to be able to add links that are either linking to a page on my website or an external link.

What happened

I am able to add links however when adding a 'External Link' or 'Page Link' the link value is never stored in the db it stays empty. When I add an 'Internal Link' the link value is stored.

What I've already tried to fix it

I have tried using the page_or_link field outside of a repeatable which works fine and stores the value of all the different links types in the db but I for my purpose I need it inside the repeatable.

Backpack, Laravel, PHP, DB version

When I run php artisan backpack:version the output is:

PHP VERSION:

PHP 7.4.4 (cli) (built: Mar 17 2020 13:49:19) ( ZTS Visual C++ 2017 x64 )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

LARAVEL VERSION:

v8.35.1@d118c0df39e7524131176aaf76493eae63a8a602

BACKPACK VERSION:

4.1.41@44770347b918e42c052d0a138c24535b43e32472

@welcome
Copy link

welcome bot commented May 5, 2021

Hello there! Thanks for opening your first issue on this repo!

Just a heads-up: Here at Backpack we use Github Issues only for tracking bugs. Talk about new features is also acceptable. This helps a lot in keeping our focus on improving Backpack. If you issue is not a bug/feature, please help us out by closing the issue yourself and posting in the appropriate medium (see below). If you're not sure where it fits, it's ok, a community member will probably reply to help you with that.

Backpack communication channels:

  • Bug Reports, Feature Requests - Github Issues (here);
  • Quick help (How do I do X) - Gitter Chatroom;
  • Long questions (I have done X and Y and it won't do Z wtf) - Stackoverflow, using the backpack-for-laravel tag;
  • Showing off something you've made, asking for opinion on Backpack/Laravel matters - Reddit;

Please keep in mind Backpack offers no official / paid support. Whatever help you receive here, on Gitter, Slack or Stackoverflow is thanks to our awesome awesome community members, who give up some of their time to help their peers. If you want to join our community, just start pitching in. We take pride in being a welcoming bunch.

Thank you!

--
Justin Case
The Backpack Robot

@tabacitu tabacitu added Priority: SHOULD Possible Bug A bug that was reported but not confirmed yet. and removed triage labels Sep 2, 2021
@tabacitu
Copy link
Member

tabacitu commented Sep 20, 2021

Hey @valerinakov ,

Unfortunately this field type does NOT work in repeatable. We plan to rewrite repeatable in 4.2 (soon) so that we have a solution for this. Until then, I'm afraid the only way to proceed is to create a custom solution... I mean hacking a solution in your project alone, by publishing this field to your project and modifying it...

Sorry I don't have better news...
Cheers!

@tabacitu
Copy link
Member

@pxpm this could be a good opportunity to introduce someone else into "how to make a field repeatable-friendly". Since @karandatwani92 and @jorgetwgroup are now responsible for 5.x, I'd say you guys have a quick meeting, look at the code and decide what needs to be done, then let them do it. One can do, one can review. Then Karan can write a how-to for this.

Ironically... having this field work inside repeatable is a COULD-DO, buut... having a tutorial on how to do this for custom fields... that's a SHOULD-DO or MUST-DO 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Possible Bug A bug that was reported but not confirmed yet. Priority: COULD Priority: SHOULD
Projects
Status: No status
Development

No branches or pull requests

5 participants