Jump to content

FEZ

Members
  • Posts

    6
  • Joined

  • Last visited

Posts posted by FEZ

  1. Okay... I got a first fix (but it does not help yet)

    in ProcessPageEditLink.module you need to replace the existing getFiles() method with the following code. It iterates thru all RepeaterFields as well. This results in all images being shown:

    protected function getFiles() {
    	$files = array();
    	if($this->page->id) {
    		$files = $this->getFilesFromPage($this->page);
    	}
    	asort($files); 
    	return $files;
    }
    	
    protected function getFilesFromPage($pageToCheck){
    	$files = array();
    	foreach($pageToCheck->fields as $field) {
    		if($field->type instanceof FieldtypeFile){
    			foreach($pageToCheck->get($field->name) as $file) {
    				$files[$file->url] = $field->getLabel() . ': ' . $file->basename; 
    			}
    		}
    		else if($field->type instanceof FieldtypeRepeater){
    			foreach($pageToCheck->$field as $repeaterPage){
    				$files = array_merge($this->getFilesFromPage($repeaterPage),$files);
    			}
    		}
    		else {
    			
    		}
    	}
    	return $files;
    }
    

    Just to make sure we have it all in here. This was the original code of getFiles()

    protected function getFilesOrig() {
    	$files = array();
    	if($this->page->id) foreach($this->page->fields as $f) {
    		if(!$f->type instanceof FieldtypeFile) continue;
    		foreach($this->page->get($f->name) as $file) {
    			$files[$file->url] = $f->getLabel() . ': ' . $file->basename; 
    		}
    	}
    	asort($files); 
    	return $files;
    }
    

    So this works now. Only problem is, that InputfieldAssistedURL.module uses not the main page ID as the link.

    So when the InputField is placed inside a repeater, it sends the ID of the repeater and not the one of the page (repeaters behave like pages). So we need to break out to main page from this repeater as well to see all images of the page...

    I will follow up on this.

    (Side question: Any hint were I should post my getFiles() patch so it might end up in the main core?)

  2. OMG this one is what I have been looking for.

    But I have one challange. I do use repeaters quite a lot in my templates. And images in those repeaters are not listed? Are you aware of this? Maybe even working on a fix?

    I will dig into it in the following days, but if you are already on it let me know ;-)

    Felix

×
×
  • Create New...