Adds the ability to change the folder where Elements are stored #293

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants

mdunham commented Nov 3, 2011

You can call $this->elementFolder = ''; before any $this->element(); call to change the folder name where elements are stored. This adds greater flexibility to cake.

Fixes RFC #2213
http://cakephp.lighthouseapp.com/projects/42648-cakephp/tickets/2213-i-would-like-to-be-allowed-to-change-where-elements-are-stored

foreach ($exts as $ext) {
foreach ($paths as $path) {
- if (file_exists($path . 'Elements' . DS . $name . $ext)) {
- return $path . 'Elements' . DS . $name . $ext;
+ if (file_exists($path . $elementFolder . DS . $name . $ext)) {
@ADmad

ADmad Nov 4, 2011

Member

Don't see any need to copy the class property into a local variable when its not going to be manipulated.
Can just do if (file_exists($path . $this->elementFolder . DS . $name . $ext)) {

@mdunham

mdunham Nov 4, 2011

Fair point, I will revise.

On Nov 4, 2011, at 3:27 AM, ADmad reply@reply.github.com wrote:

   foreach ($exts as $ext) {
       foreach ($paths as $path) {
  •            if (file_exists($path . 'Elements' . DS . $name . $ext)) {
    
  •                return $path . 'Elements' . DS . $name . $ext;
    
  •            if (file_exists($path . $elementFolder . DS . $name . $ext)) {
    

Don't see any need to copy the model property into a local variable when its not going to be manipulated.
Can just do if (file_exists($path . $this->elementFolder . DS . $name . $ext)) {


Reply to this email directly or view it on GitHub:
https://github.com/cakephp/cakephp/pull/293/files#r209147

mdunham commented Nov 4, 2011

Will also update the debug message closing and will repush later.

@mdunham mdunham closed this Nov 4, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment