New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: add ability to get_content by 'id' #1058

Closed
edalzell opened this Issue Oct 23, 2016 · 0 comments

Comments

Projects
None yet
2 participants
@edalzell

edalzell commented Oct 23, 2016

I wrote get_content_by_id to essentially do the same as get_content but w/ an id instead of a uri.

Would be awesome if there was an additional param id in get_content, i.e. {{ get_content id="234234" }} that acted the same as{{ get_content from="/about" }}`

Here's my code if it helps:

    public function index()
    {
        $data = [];
        if ($id = $this->getParam('id'))
        {
            /** @var \Statamic\Data\Data $data */
            $data = Data::find($id);
        }

        return $this->parse($data->toArray());
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment