Was receiving following notice after installing module:

Notice: Undefined index: field_html_trim in field_html_trim_preprocess_field() (line 105 of modules/field_html_trim/field_html_trim.module).

Included quick patch to check if they array key exists before attempting to access it.

Comments

squidgle created an issue. See original summary.

frogdog_tech’s picture

frogdog_tech’s picture

Issue summary: View changes
frogdog_tech’s picture

Later received this notice as well:

Notice: Undefined index: enable_html_trim in field_html_trim_field_formatter_settings_summary_alter() (line 77 of modules/field_html_trim/field_html_trim.module).

Here is a new patch that fixes both issues.

frogdog_tech’s picture

Title: Notice: Undefined index: field_html_trim in field_html_trim_preprocess_field() (line 105 of modules/field_html_trim/field_html_trim.module). » Multiple - Notice: Undefined index.
jzavrl’s picture

Status: Active » Needs review
StatusFileSize
new2.55 KB

Rerolled the patch against latest dev version, the previous patch didn't apply.

c_archer’s picture

Hi All,

As this been resolved as I'm still getting the error?

Thanks,
Chris

leandro713’s picture

#6 works for me
thanks, @jzavrl !!

leandro713’s picture

StatusFileSize
new2.61 KB

There was still a warning, i attach patch over patched code by #6 that resolves the problem.

Here is the interdiff of my added code only:

     $settings = $context['formatter']->getThirdPartySettings('field_html_trim');
 
-    if ($settings['enable_html_trim']) {
-      if ($settings['html_trim']['exclude_html_from_trim_count']) {
+    if (!empty($settings) && $settings['enable_html_trim']) {
+      if (isset($settings['enable_html_trim']) && $settings['enable_html_trim']) {
         $summary[] = t('HTML tags exluded from trim count');
       }
leandro713’s picture