Skip to main content
added 2 characters in body
Source Link
4life
  • 4.7k
  • 8
  • 26
  • 25

In my computed field I'm trying to makeitmake it display the field and it's label only if the value is negative. If it is above 0 it should not display anything, not even field label.

So far in "Display Code (PHP)" I have:

if $entity_field_item['value'] < '0' { ;
$display_output = $entity_field_item['value'] . '%';
}else{$display_output = ''};

But it just returns the label with no value.

The classic

$display_output = $entity_field_item['value'] . '%';

works fine though.

In my computed field I'm trying to makeit display the field and it's label only if the value is negative. If it is above 0 it should not display anything, not even field label.

So far in "Display Code (PHP)" I have:

if $entity_field_item['value'] < '0' { ;
$display_output = $entity_field_item['value'] . '%';
}else{$display_output = ''};

But it just returns the label with no value.

The classic

$display_output = $entity_field_item['value'] . '%';

works fine though.

In my computed field I'm trying to make it display the field and it's label only if the value is negative. If it is above 0 it should not display anything, not even field label.

So far in "Display Code (PHP)" I have:

if $entity_field_item['value'] < '0' { ;
$display_output = $entity_field_item['value'] . '%';
}else{$display_output = ''};

But it just returns the label with no value.

The classic

$display_output = $entity_field_item['value'] . '%';

works fine though.

Source Link
drupalina
  • 487
  • 4
  • 15

Computed Field display only if below 0

In my computed field I'm trying to makeit display the field and it's label only if the value is negative. If it is above 0 it should not display anything, not even field label.

So far in "Display Code (PHP)" I have:

if $entity_field_item['value'] < '0' { ;
$display_output = $entity_field_item['value'] . '%';
}else{$display_output = ''};

But it just returns the label with no value.

The classic

$display_output = $entity_field_item['value'] . '%';

works fine though.