0

I am trying to set the revision log in a custom module in drupal 8, using $media->set("revision_log","test message")

and it doesnt work. This method is working for all of the other fields. why doesnt it work for the revision_log?

6
  • What type of entity is $media?
    – Clive
    May 1, 2017 at 11:13
  • It's a media entity
    – Diana
    May 1, 2017 at 11:13
  • 1
    Try $media->setRevisionLogMessage('foo');. If you get an undefined method error, the entity type probably doesn't support revisions. If you don't get an error, you might have forgotten to save the entity
    – Clive
    May 1, 2017 at 11:28
  • This question is too broad because it doesn't make clear what exactly doesn't work. At least, the question should show what error is given, if there is an error, and it should show more of the code used for the purpose.
    – apaderno
    May 13, 2019 at 8:45
  • 1
    From a single code line isn't possible to answer to Why doesn't the code work? It could be that $media is not initialized, it is initialized with the wrong value, it contains a reference to an entity that doesn't support revisions or that doesn't have any revision_log property/field; the function/method containing that line is not called; the line is contained in a if statement that is not executed for many reason; the module containing that line is not installed; the shown line is not executed because it's commented out; there is another module that reverts any change done; etc etc.
    – apaderno
    May 13, 2019 at 9:09

1 Answer 1

1

$media->setRevisionLogMessage('foo');

Not the answer you're looking for? Browse other questions tagged or ask your own question.