Image Field Malfunction in Blog Module

edited April 2013 in Modules
I'm trying to add an image field to the "Blog Settings" section of the CMS that I can use to allow that image to be displayed at the top of every blog page. However, while I've successfully added the field to the form in the CMS, the POST behavior of the form is weird.

What I've done:
In fuel/modules/blog/controllers/settings.php: index(): Added line 45:
$fields['top_image'] = array('type' => 'image', 'value' => '', 'description' => lang('form_helptext_top_image'));

In the fuel/modules/blog/config/blog.php: Added line 43:
$config['blog']['top_image'] = '';

In the database table fuel_blog_settings: Added another row with "name"="top_image" and "value"=""


What happens:
I get the field in the "Blog Settings" section of the CMS, whenever I click save (whether I've chosen a file or not), the field gets saved as "{mypath}/assets/images". It doesn't even add whatever I've entered into the field at the end of that path. It just saves it as that path no matter what I do. After digging around a little, I found that the POST value for the field was always being given that value, and I'm not sure why. Any help I can get figuring out why this is happening would be greatly appreciated.

Comments

  • edited 2:59PM
    So if you debug the $_POST value on line 22 of the settings.php controller file, do you see that value in there? Also, I believe the 'type' value should be removed from $fields['top_image'] so as to give you a text field.

    Also, as an FYI, in the 1.0 beta, blog settings has been removed in favor of the FUEL settings module:
    https://github.com/daylightstudio/FUEL-CMS/tree/1.0
    https://github.com/daylightstudio/FUEL-CMS-Blog-Module
    https://github.com/daylightstudio/FUEL-CMS-User-Guide-Module
  • edited 2:59PM
    Yes I do see the value in the $_POST variable. This is what I get when I put anything into the "top_image" field (by anything, I mean whether I leave it empty, manually type something in, use the "Select Image" button, or use the "Choose File" button. The top_image field does not change what gets submitted no matter which of the above I do):

    Array
    (
    [settings] => Array
    (
    [title] => My Blog
    [description] => This is a test blog
    [top_image] => /Users/kelvin/projects/fuelcms/assets/images/
    [uri] => blog/
    [theme_path] => themes/default/
    [theme_layout] => blog
    [theme_module] => blog
    [allow_comments] => 1
    [monitor_comments] => 1
    [use_captchas] => 1
    [save_spam] => 1
    [akismet_api_key] =>
    [multiple_comment_submission_time_limit] => 30
    [comments_time_limit] =>
    [cache_ttl] => 3600
    [asset_upload_path] => images/blog/
    [per_page] => 2
    )

    )

    I could remove the image type value as you suggest and have my client just type in the image name, but that would require my client to upload the image first through the assets section then input the name according to that, instead of taking advantage of the "Select Image" and "Choose File" buttons that the image type provides. If at all possible, I would prefer to not have to rely on a workaround like that since my client is not technically proficient (and plus workarounds like that are easy to forget how to do). Unfortunately, I'm also under time constraints so switching to the FUEL 1.0 beta and dealing with all of the potential compatibility issues that might come with is also not an option.
  • edited 2:59PM
    Image uploads aren't supported by the blog settings controller (neither are they in the FUEL 1.0 beta). The image uploads work for controllers that extend the module controller and the settings controller does not.
  • edited 2:59PM
    Okay. Thanks. Good to know. I guess I'll just do the workaround you mentioned then.
Sign In or Register to comment.