Networking\InitCmsBundle\Helper\PageHelper::getFieldValue PHP Method

getFieldValue() public static method

Fetch the variables from the given content type object
public static getFieldValue ( Networking\InitCmsBundle\Model\PageInterface $object, $fieldName, null $method = null ) : mixed
$object Networking\InitCmsBundle\Model\PageInterface
$fieldName
$method null
return mixed
    public static function getFieldValue(PageInterface $object, $fieldName, $method = null)
    {
        $getters = array();
        // prefer method name given in the code option
        if ($method) {
            $getters[] = $method;
        }
        $camelizedFieldName = self::camelize($fieldName);
        $getters[] = 'get' . $camelizedFieldName;
        $getters[] = 'is' . $camelizedFieldName;
        foreach ($getters as $getter) {
            if (method_exists($object, $getter)) {
                return call_user_func(array($object, $getter));
            }
        }
        throw new NoValueException(sprintf('Unable to retrieve the value of `%s`', $camelizedFieldName));
    }