Controller_Shindig_Post::action_update PHP Method

action_update() public method

Update an existing post
public action_update ( )
    public function action_update()
    {
        $this->request->response = View::factory('shindig/admin/edit_post')->set('form_title', __('Update Post'))->bind('use_authors', $use_authors)->bind('site_url', $site_url)->bind('errors', $errors)->bind('post', $post);
        $use_authors = Kohana::config('shindig.use_authors');
        $site_url = URL::site('blog', TRUE) . '/';
        $post = Sprig::factory('shindig_post')->values(array('id' => $this->request->param('id')))->load();
        if (isset($_POST['shindig_post'])) {
            try {
                /*
                if ($tags = Arr::get($_POST, 'tags'))
                {
                	foreach ($tags as $tag)
                	{
                		// check to see if tag exsists. 
                		// Get id if it does, create it if it doesn't
                	}
                }
                */
                $post->values($_POST)->update();
                Request::instance()->redirect(Route::get(Kohana::config('shindig.post_create_redirect.route'))->uri(array('action' => Kohana::config('shindig.post_create_redirect.action'), 'id' => $post->id)));
            } catch (Validate_Exception $e) {
                $errors = $e->array->errors('shindig/crud');
            }
        }
    }