public function getItems(Batch $batch)
 {
     $types = array();
     foreach ($batch->getPages() as $page) {
         if ($page->getType() && !in_array($page->getType(), $types)) {
             $types[] = $page->getType();
         }
     }
     $pageTypes = $batch->getObjectCollection('page_type');
     if (is_object($pageTypes)) {
         foreach ($pageTypes->getTypes() as $pageType) {
             if (!in_array($pageType->getHandle(), $types)) {
                 $types[] = $pageType->getHandle();
             }
             $target = $pageType->getPublishTarget();
             if ($target instanceof PageTypePublishTarget) {
                 if (!in_array($target->getPageType(), $types)) {
                     $types[] = $target->getPageType();
                 }
             }
         }
     }
     $items = array();
     foreach ($types as $type) {
         $item = new Item();
         $item->setIdentifier($type);
         $items[] = $item;
     }
     return $items;
 }
Example #2
0
 public function getItems(Batch $batch)
 {
     $users = array();
     foreach ($batch->getPages() as $page) {
         if ($page->getUser() && !in_array($page->getUser(), $users)) {
             $users[] = $page->getUser();
         }
     }
     $pageTypes = $batch->getObjectCollection('page_type');
     if (is_object($pageTypes)) {
         foreach ($pageTypes->getTypes() as $type) {
             $defaults = $type->getDefaultPageCollection();
             foreach ($defaults->getPages() as $page) {
                 if ($page->getUser() && !in_array($page->getUser(), $users)) {
                     $users[] = $page->getUser();
                 }
             }
         }
     }
     $items = array();
     foreach ($users as $user) {
         $item = new Item();
         $item->setIdentifier($user);
         $items[] = $item;
     }
     return $items;
 }
 public function getItems(Batch $batch)
 {
     $templates = array();
     foreach ($batch->getPages() as $page) {
         if ($page->getTemplate() && !in_array($page->getTemplate(), $templates)) {
             $templates[] = $page->getTemplate();
         }
     }
     $pageTemplates = $batch->getObjectCollection('page_template');
     if (is_object($pageTemplates)) {
         foreach ($pageTemplates->getTemplates() as $pageTemplate) {
             if (!in_array($pageTemplate->getHandle(), $templates)) {
                 $templates[] = $pageTemplate->getHandle();
             }
         }
     }
     $pageTypes = $batch->getObjectCollection('page_type');
     if (is_object($pageTypes)) {
         foreach ($pageTypes->getTypes() as $pageType) {
             if ($template = $pageType->getDefaultTemplate()) {
                 if (!in_array($template, $templates)) {
                     $templates[] = $template;
                 }
             }
             if ($pageType->getAllowedTemplates() == 'C') {
                 foreach ($pageType->getTemplates() as $template) {
                     if (!in_array($template, $templates)) {
                         $templates[] = $template;
                     }
                 }
             }
         }
     }
     $items = array();
     foreach ($templates as $template) {
         $item = new Item();
         $item->setIdentifier($template);
         $items[] = $item;
     }
     return $items;
 }
 public function getItems(Batch $batch)
 {
     $handles = array();
     foreach ($batch->getPages() as $page) {
         foreach ($page->getAttributes() as $attribute) {
             if (!in_array($attribute->getAttribute()->getHandle(), $handles)) {
                 $handles[] = $attribute->getAttribute()->getHandle();
             }
         }
     }
     $pageTypes = $batch->getObjectCollection('page_type');
     if (is_object($pageTypes)) {
         foreach ($pageTypes->getTypes() as $type) {
             foreach ($type->getLayoutSets() as $set) {
                 foreach ($set->getControls() as $control) {
                     if ($control instanceof CollectionAttributeComposerFormLayoutSetControl) {
                         if (!in_array($control->getItemIdentifier(), $handles)) {
                             $handles[] = $control->getItemIdentifier();
                         }
                     }
                 }
             }
             $defaults = $type->getDefaultPageCollection();
             foreach ($defaults->getPages() as $page) {
                 foreach ($page->getAttributes() as $attribute) {
                     if (!in_array($attribute->getAttribute()->getHandle(), $handles)) {
                         $handles[] = $attribute->getAttribute()->getHandle();
                     }
                 }
             }
         }
     }
     $items = array();
     foreach ($handles as $handle) {
         $item = new Item();
         $item->setIdentifier($handle);
         $items[] = $item;
     }
     return $items;
 }