Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blog validation broken in 2.2 when updating (stream fields) ? #3400

Closed
ipimpat opened this issue Aug 4, 2014 · 0 comments
Closed

Blog validation broken in 2.2 when updating (stream fields) ? #3400

ipimpat opened this issue Aug 4, 2014 · 0 comments
Milestone

Comments

@ipimpat
Copy link

ipimpat commented Aug 4, 2014

The stream validation array is never passed to the form_validation library, because the variable which they gets assigned to is overwritten by the next line which is the rules for the "static" fields

Or am i wrong?

I havn't checked it but I used the blog module codebase as a base for another module I'm currently writing

From line 313 -> 329 (https://github.com/pyrocms/pyrocms/blob/2.2/master/system/cms/modules/blog/controllers/admin.php)

// Get the validation for our custom blog fields.
$blog_validation = $this->streams->streams->validation_array($stream->stream_slug, $stream->stream_namespace, 'new');

$blog_validation = array_merge($this->validation_rules, array(
    'title' => array(
        'field' => 'title',
        'label' => 'lang:global:title',
        'rules' => 'trim|htmlspecialchars|required|max_length[100]|callback__check_title['.$id.']'
    ),
    'slug' => array(
        'field' => 'slug',
        'label' => 'lang:global:slug',
        'rules' => 'trim|required|alpha_dot_dash|max_length[100]|callback__check_slug['.$id.']'
    ),
));

// Merge and set our validation rules
$this->form_validation->set_rules(array_merge($this->validation_rules, $blog_validation));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants