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

'Fomatter' error for Title field in cambridge_teasers_preprocess_field() #40

Open
JennyCumming opened this issue Mar 27, 2019 · 0 comments

Comments

@JennyCumming
Copy link

We use a title field in our vertical_teaser - this is throwing an error at line 65 as the title field element doesn't contain a "#formatter" array item.

Notice: Undefined index: #formatter in cambridge_teasers_preprocess_field() (line 65 of profiles/cambridge/modules/features/cambridge_teasers/cambridge_teasers.module).

Can we add an additional check in at line 65 to either - check the field isn't title, or check that the #formatter array item exists before we try and get the format. The latter seems a better solution to be able to prevent for any other fields that don't have a formatter array item.

So either:
&& isset($vars['element']['#formatter']) before the 'smart_trim_format' === $vars['element']['#formatter'] check

OR

&& $vars['element']['#field_name'] !== 'title' before the 'smart_trim_format' === $vars['element']['#formatter'] check

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

No branches or pull requests

1 participant