public function updateSingleValue($contenttype, $id, $field, $value)
    {
        $id = intval($id);

        if (!$this->isValidColumn($field, $contenttype)) {
            $error = Trans::__('contenttypes.generic.invalid-field', ['%field%' => $field, '%contenttype%' => $contenttype]);
            $this->app['logger.flash']->danger($error);

            return false;
        }

        $content = $this->getContent("$contenttype/$id");

        $content->setValue($field, $value);

        $comment = Trans::__(
            'The field %field% has been changed to "%newValue%"',
            [
                '%field%'    => $field,
                '%newValue%' => $value,
            ]
        );

        $result = $this->saveContent($content, $comment);

        return $result;
    }
public function updateSingleValue($contenttype, $id, $field, $value)
    {
        $id = intval($id);

        if (!$this->isValidColumn($field, $contenttype)) {
            $error = Trans::__('contenttypes.generic.invalid-field', ['%field%' => $field, '%contenttype%' => $contenttype]);
            $this->app['logger.flash']->danger($error);

            return false;
        }

        $content = $this->getContent("$contenttype/$id");

        $content->setValue($field, $value);

        $comment = Trans::__(
            'The field %field% has been changed to "%newValue%"',
            [
                '%field%'    => $field,
                '%newValue%' => $value,
            ]
        );

        $result = $this->saveContent($content, $comment);

        return $result;
    }
public function updateSingleValue ( $ contenttype , $ id , $ field , $ value ) { $ id = intval ( $ id ) ; if ( ! $ this -> isValidColumn ( $ field , $ contenttype ) ) { $ error = Trans :: __ ( 'contenttypes.generic.invalid-field' , [ '%field%' => $ field , '%contenttype%' => $ contenttype ] ) ; $ this -> app [ 'logger.flash' ] -> danger ( $ error ) ; return false ; } $ content = $ this -> getContent ( "$contenttype/$id" ) ; $ content -> setValue ( $ field , $ value ) ; $ comment = Trans :: __ ( 'The field %field% has been changed to "%newValue%"' , [ '%field%' => $ field , '%newValue%' => $ value , ] ) ; $ result = $ this -> saveContent ( $ content , $ comment ) ; return $ result ; }
Update a single value from content.

It is called in list of contents.

@param string $contenttype Content Type to be edited.
@param int    $id          Id of content to be updated.
@param string $field       Field name of content to be changed.
@param mixed  $value       New value to be defined on field.

@return bool Returns true when update is done or false if not.
Update a single value from content .