Problem/Motivation

In static yml files where it would be impossible to get the published date, it would be useful to have a published_date (and corrected_date) token. A great example is the metatag yml files where one would want to have a metatag to show a node's published or corrected date (like one would want to show a created or changed timestamp in the page's metadata.)

Steps to reproduce

n/a

Proposed resolution

Expose a published_date token.

Remaining tasks

Create the published_date token.

User interface changes

n/a

API changes

n/a

Data model changes

n/a

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

monochromatic created an issue. See original summary.

spotzero’s picture

Hey @monochromatic,

I love this feature. There are a couple of features missing from your implementation that I'd like to see for it to be fully included.

First, token support for all three fields, published date, corrected date, and the corrected number.

Second, support for the configured date formats, so that these date tokens work like all the other date tokens.

Looking at `field_token_info_alter` in the token module's token.tokens.inc file, it looks like if you define the date tokens in hook_token_info() in the right way, all of the date options should show up and you might not need your own hook_tokens implementation for the dates.

spotzero’s picture

Status: Active » Fixed

I lost track of this issue and this feature got implemented at a object hook. I wanted to give you the contributions, so your MR is merged into 8.x.

Thanks for your work on this.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.