Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
databird opened this issue Jan 30, 2025 · 0 comments
Open

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

databird opened this issue Jan 30, 2025 · 0 comments

Comments

@databird
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant