Code Monkey home page Code Monkey logo

silverstripe-simplelistfield's Introduction

silverstripe-simplelistfield

A module to store and display simple and lightweight contents

silverstripe-simplelistfield's People

Contributors

anhld avatar silverbusters avatar

Watchers

 avatar

silverstripe-simplelistfield's Issues

Problem with preloadScenarios function

We've run into an issue on several sites that use this module with the Simline template portfolio system when trying to edit Portfolio Items. The following warning appears:

[Warning] Invalid argument supplied for foreach()
/container/application/public/silverstripe-simplelistfield/forms/SimpleListField/SimpleListField.php:144

We are then unable to edit or save any changes to the Portfolio Item.

The problem is in the preloadScenarios function in SimpleListField.php and it appears that the variable $scenarios is not coming through as an array.

public static function preloadScenarios(){
		if(self::$preloaded_scenario === false){
			self::$preloaded_scenario = true;
			
			$scenarios = Config::inst()->get('SimpleListField', 'Scenarios');
			
			foreach($scenarios as $key => $val){
				if( isset($val['preload']) && $val['preload'] ){
					self::$scenarios[$key] = $val;
				}
			}
		}
	}

There doesn't seem to be any need to preload Scenarios for the module to work so we've been able to get around it by simply commenting out line 20 of SimpleListField.php so the function is not called. However this isn't exactly a fix.

My guess is that the scenarios for preload should be defined in a config file somewhere but there are no instructions on how to do this that I can see.

SimpleListField invalid argument warning.docx

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.