Search code examples
phpdrupal-7php-5.6drupal-themes

Drupal 7 theme Template.php Unexpected T_OBJECT_OPERATOR error


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!


Solution

  • 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;}
    };