Problem/Motivation

The documentation code has incorrect PHP syntax, and is a bit messed up

Proposed resolution

Fix it

Remaining tasks

Do it

User interface changes

None

API changes

None

Data model changes

None

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue category Task because documentation updated needs to be done
Issue priority Normal
Unfrozen changes Unfrozen because it only changes documentation
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

googletorp created an issue. See original summary.

googletorp’s picture

Status: Active » Needs review
FileSize
794 bytes

The code probably used to say entity_create(...

Anyways this fixes the example code.

googletorp’s picture

Issue summary: View changes

Updated beta evaluation.

jhodgdon’s picture

Status: Needs review » Needs work

Can we possibly fix up the rest of this doc block too? See
https://api.drupal.org/api/drupal/core!includes!entity.inc/function/enti...

In the Deprecated secition, it says "....If the display is available in configuration use:" and then it ends abruptly, so something is wrong there.

Also, why are we giving examples on a deprecated function anyway? We should just say it's deprecated and say what to use instead.

googletorp’s picture

Status: Needs work » Needs review

#4 It seems like API site is broken or we need to fix all depricated docs. We do this a lot of places:

* @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0.
* If the entity form display is available in configuration use:
* @code
* \Drupal::entityManager()->getStorage('entity_form_display')->load($entity_type . '.' . $bundle . '.' . $form_mode);
* @endcode

But API just kills everything after the initial @code. I'm not expert in doxygen, but my guess is that the documentation is fine a tweak is needed to pull out code samples inside a @deprecated tag.

googletorp’s picture

Note if this is a mistake in the documentation syntax, we should probably make a seperate task for it, as all documentation use this structure which apparently doesn't work well on the API site.

jhodgdon’s picture

Ah. Sorry, I didn't look at the file... If there is no blank line inside the @deprecated, that seems like an API module bug. Filed:
#2549525: Code samples and/or multi-line not working in @deprecated

So let's just fix up the examples then...

jhodgdon’s picture

Oh, it could be the indentation. Normally inside @param, @return, @deprecated, etc. everything (including @code tags) should be indented by 2 spaces. This isn't, so probably the API module is reading it as "OK, indentation went back to 0, that's it for @deprecated".

googletorp’s picture

I fixed indentation of @code tags under @deprecate tags.

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

That looks good, thanks!

  • webchick committed f154a0e on 8.0.x
    Issue #2547933 by googletorp, jhodgdon: Code example for non deprecated...
webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.0.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.