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

ModelName missing in $FIELDS$ #169

Closed
kay899 opened this issue May 27, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@kay899
Copy link

commented May 27, 2016

HI,

first of all I want to say a big Thank You for this wonderful package. I am actually testing it since two days and it really works great.

As I am doing a German Webpage, I need to have some translation for my field names.
I solved translations e.g. in the index or show page like this:

{!! Form::label('$FIELD_NAME$', trans('models.$MODEL_NAME$.$FIELD_NAME$')) !!}

This is working perfectly and I refactor my langfiles, so that I have an array of translations for each model.

Now I want to do the same for the fields in create view, but here the model name is missing as a parameter. Would it be possible to add these also to that function, so that we could use these:

$MODEL_NAME$
$MODEL_NAME_CAMEL$

Would be wonderful.

Thanks in advance
kay899

@kay899

This comment has been minimized.

Copy link
Author

commented May 28, 2016

I changed this locally for the moment with adding this line in

InfyOm\Generator\Generators\Scaffold\ViewGenerator

in generateFields() function:

if (!empty($fieldTemplate)) {
    // Adding this line for having $Model_NAME$ for the fields
    $fieldTemplate = str_replace('$MODEL_NAME$', $this->commandData->config->mName, $fieldTemplate);
    $fieldTemplate = TemplateUtil::fillFieldTemplate(
        $this->commandData->fieldNamesMapping,
        $fieldTemplate,
        $field
    );
    $this->htmlFields[] = $fieldTemplate;
}

Perhaps you want to exctend it like this?

Regards
kay899

mitulgolakiya added a commit that referenced this issue May 29, 2016

@mitulgolakiya

This comment has been minimized.

Copy link
Member

commented May 29, 2016

@kay899 Actually we were not passing those fields in fields template. I have pushed a fix in develop branch. Will push it to the master in next release.

@mitulgolakiya mitulgolakiya added this to the 0.1 milestone May 29, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.