Skip to content

$fm->listLayouts() only return first level of layouts #16

Open
@databird

Description

@databird

If you have layout's folder, sub-layouts are not get with function $fm->listLayouts()

Here's the adapted code for getting the first sublevel :

function listLayouts()
   {
      $result = array();

      $apiResult = $this->apiListLayouts();

      if ($this->translateResult) {
         if (! fmGetIsError($apiResult)) {

            $response = $this->getResponse($apiResult);
            $layouts = array_key_exists('layouts', $response) ? $response['layouts'] : array();
            foreach ($layouts as $layout) {
               if (array_key_exists('name', $layout)) {
                  $result[] = $layout['name'];
               }
                   // added by databird :
			   if (array_key_exists('folderLayoutNames', $layout)) {
				  foreach ($layout['folderLayoutNames'] as $sublayout) {
					  if (array_key_exists('name', $sublayout)) {
						$result[] = $sublayout['name'];
					  }
				  }                  
               }
            }
         }
      }
      else {
         $result = $apiResult;
      }

      return $result;
   }

Maybe need to improve for getting multilevel and same probleme occured with "listScript" function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions