-1

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!

Abdul Rehman
  • 5,326
  • 9
  • 77
  • 150
  • This is not php syntax and is missing from some information , where field_image_alt_text provide ? .. make no sens. – Fky Sep 11 '18 at 11:35

1 Answers1

0

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;}
};
Evgeniy Chorniy
  • 141
  • 1
  • 1
  • 11
  • I have tried this: `function laurel2015_preprocess_article(&$variables) { if (strlen(field_image_alt_text->getValue()) = 0 || null ) { set 'laurel_image'; }else {return;} };` but it says: `syntax error UNEXPECTED T_OBJECT_OPERATOR, expecting ',' or ')'` – Abdul Rehman Sep 11 '18 at 08:25