Drupal 7 theme Template.php Unexpected T_OBJECT_OPERATOR error

38 views Asked by At

I'm new to Drupal development and trying to run a preprocess function for a content type inside my custom theme's template.php.

Here's my code:

function MYTHEME_preprocess_article(&$variables) {
  if (!field_image_alt_text->getValue().strlen() = 0 || null ) { set value to something }else {return;}
};

but it returns a syntax error as:

Syntax Error: Unexpected T_OBJECT_OPERATOR

How can I . resolve this error?

Thanks in advance!

1

There are 1 answers

1
Evgeniy Chorniy On BEST ANSWER

u dont resolve this, code not php language

function MYTHEME_preprocess_article(&$variables) {
  if (strlen(field_image_alt_text->getValue()) = 0 || null ) { set value to something }else {return;}
};