🏡 index : ~doyle/koselig.git

author Jordan Doyle <jordan@doyle.wf> 2016-10-16 9:41:51.0 +00:00:00
committer Jordan Doyle <jordan@doyle.wf> 2016-10-16 9:41:51.0 +00:00:00
commit
24418a487a4c0d728c678b1382351672197b09a0 [patch]
tree
8eada5bad4a0908b7ee81c5434b6d41f1d49a8da
parent
83f80306ebf99f9e4006a5cbf8a4a6d971f2fa03
download
24418a487a4c0d728c678b1382351672197b09a0.tar.gz

allow post models to be passed into 'acf' too



Diff

 src/Models/Meta.php | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/Models/Meta.php b/src/Models/Meta.php
index d266c30..0927c17 100644
--- a/src/Models/Meta.php
+++ b/src/Models/Meta.php
@@ -71,8 +71,8 @@ class Meta extends Model
     * Grab an ACF field from the database.
     *
     * @see Meta::get()
     * @param int|string|null $page page to get meta for (or name of the meta item to get
     *                              if you want to get the current page's meta)
     * @param int|string|null|Post $page page to get meta for (or name of the meta item to get
     *                                   if you want to get the current page's meta)
     * @param string|null $name
     * @param bool $format whether to format this field or not
     * @throws UnsatisfiedDependencyException
@@ -80,6 +80,10 @@ class Meta extends Model
     */
    public static function acf($page = null, $name = null, $format = true)
    {
        if (is_object($page) && (is_subclass_of($page, Post::class) || $page instanceof Post)) {
            $page = $page->ID;
        }

        if (!ctype_digit((string) $page) && $name === null) {
            $name = $page;
            $page = null;