Controller_Shindig_Post::action_create PHP Method

action_create() public method

Create a new post
public action_create ( )
    public function action_create()
    {
        $this->request->response = View::factory('shindig/admin/edit_post')->set('form_title', __('Create New Post'))->set('use_authors', Kohana::config('shindig.use_authors'))->bind('site_url', $site_url)->bind('errors', $errors)->bind('post', $post);
        $site_url = URL::site('blog', TRUE) . '/';
        $post = Sprig::factory('shindig_post');
        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)->create();
                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');
            }
        }
    }