Get sidebar.
@api
@param string  $sidebar
@param array   $data
@return bool|string
507288
public static function get_sidebar( $sidebar = 'sidebar.php', $data = array() ) {
		if ( strstr(strtolower($sidebar), '.php') ) {
			return self::get_sidebar_from_php($sidebar, $data);
		}
		return self::compile($sidebar, $data);
	}
871509
public function getSuggestionFormat(array $data)
    {
        //if no suggestion format
        if (!isset($this->data['suggestion']) || !trim($this->data['suggestion'])) {
            //use best guess
            $suggestion = null;
            foreach ($data as $key => $value) {
                if (is_numeric($value)
                    || (
                        isset($value[0])
                        && is_numeric($value[0])
                    )
                ) {
                    continue;
                }

                $suggestion = $value;
                break;
            }

            //if still no suggestion
            if (is_null($suggestion)) {
                //just get the first one, i guess.
                foreach ($data as $key => $value) {
                    $suggestion = $value;
                    break;
                }
            }

            return $suggestion;
        }

        $template = cradle('global')->handlebars()->compile($this->data['suggestion']);

        return $template($data);
    }
729673
public function getSidebars(Individual $individual): Collection
    {
        return $this->module_service->findByComponent(ModuleSidebarInterface::class, $individual->tree(), Auth::user())
            ->filter(static function (ModuleSidebarInterface $sidebar) use ($individual): bool {
                return $sidebar->hasSidebarContent($individual);
            });
    }
25232
public function getThumb(array $data, array $options)
    {
        $options += array(
            'placeholder' => true,
            'imagestyle' => $this->config->get('image_style', 3));

        if (empty($options['entity_id'])) {
            return empty($options['placeholder']) ? '' : $this->getPlaceholder($options['imagestyle']);
        }

        $conditions = array(
            'entity' => $options['entity'],
            'entity_id' => $options['entity_id']
        );

        foreach ($this->getList($conditions) as $file) {
            if (isset($data[$options['entity'] . '_id']) && $file['entity_id'] == $data[$options['entity'] . '_id']) {
                return $this->getUrl($file['path'], $options['imagestyle']);
            }
        }

        return empty($options['placeholder']) ? '' : $this->getPlaceholder($options['imagestyle']);
    }
1348448
private function parseDocument(array $data)
    {
        $result = null;

        $dataSegment = $this->getArrayValue($data, DocumentInterface::KEYWORD_DATA, null);
        if (empty($dataSegment) === false && is_array($dataSegment) === true) {
            $isProbablySingle = $this->isProbablySingleIdentity($dataSegment);
            $parsed           = $isProbablySingle === true ?
                $this->parseSinglePrimaryData($dataSegment) :
                $this->parseArrayOfPrimaryData($dataSegment);

            if ($parsed !== null) {
                $result = new DocumentObject($parsed);
            }
        } elseif ($dataSegment !== null) {
            $this->errors->addDataError('Invalid element.');
        }

        return $result;
    }
437634
public function build(SidebarItem $sidebar)
    {
        if (!$this->context->isGranted('ROLE_SUPER_ADMIN')) return;
        
        $security = $sidebar->addChild('olix_security', array(
            'label' => 'Droits & accès',
            'icon'  => 'fa fa-lock fa-fw',
            'route' => 'olix_security_manager',
        ));
        $security->addChild('olix_security_users', array(
            'label' => 'Gestion des utilisateurs',
            'icon'  => 'fa fa-user fa-fw',
            'route' => 'olix_security_manager_user_list',
        ));
        $security->addChild('olix_security_groups', array(
            'label' => 'Gestion des groupes',
            'icon'  => 'fa fa-group fa-fw',
            'route' => 'olix_security_manager_group_list',
        ));
    }
826204
public function _widget_update_callback( $instance, $new_instance, $old_instance, $wp_widget ) {
		if ( ! static::_is_caching_sidebars() ) {
			return $instance;
		}

		$sidebars_widgets = wp_get_sidebars_widgets();
		foreach ( $sidebars_widgets as $_sidebar_id => $widgets ) {
			$widgets = array_flip( $widgets );
			if ( isset( $widgets[ $wp_widget->id ] ) ) {
				$sidebar_id = $_sidebar_id;
			}
		}

		if ( empty( $sidebar_id ) ) {
			return $instance;
		}

		if ( ! static::_is_caching_sidebar( $sidebar_id ) ) {
			return $instance;
		}

		$transient_id = static::get_transient_id( $sidebar_id );
		delete_transient( $transient_id );

		return $instance;
	}
221727
public function getTriggered(array $data, array $options)
    {
        $options['trigger_id'] = $this->trigger->getTriggered($data, $options);

        if (empty($options['trigger_id'])) {
            return array();
        }

        $coupons = 0;
        $results = array();

        foreach ((array) $this->getList($options) as $id => $rule) {

            if ($rule['code'] !== '') {
                $coupons++;
            }

            if ($coupons <= 1) {
                $results[$id] = $rule;
            }
        }

        // Coupons always go last
        uasort($results, function ($a) {
            return $a['code'] === '' ? -1 : 1;
        });

        return $results;
    }
1366103
public function onGetSidebarThumbnail()
    {
        $path = Input::get('path');
        $lastModified = Input::get('lastModified');

        $thumbnailParams = $this->getThumbnailParams();
        $thumbnailParams['width'] = 300;
        $thumbnailParams['height'] = 255;
        $thumbnailParams['mode'] = 'auto';

        $path = MediaLibrary::validatePath($path);

        if (!is_numeric($lastModified)) {
            throw new ApplicationException('Invalid input data');
        }

        /*
         * If the thumbnail file exists, just return the thumbnail markup,
         * otherwise generate a new thumbnail.
         */
        $thumbnailPath = $this->thumbnailExists($thumbnailParams, $path, $lastModified);
        if ($thumbnailPath) {
            return [
                'markup' => $this->makePartial('thumbnail-image', [
                    'isError' => $this->thumbnailIsError($thumbnailPath),
                    'imageUrl' => $this->getThumbnailImageUrl($thumbnailPath)
                ])
            ];
        }

        $thumbnailInfo = $thumbnailParams;
        $thumbnailInfo['path'] = $path;
        $thumbnailInfo['lastModified'] = $lastModified;
        $thumbnailInfo['id'] = 'sidebar-thumbnail';

        return $this->generateThumbnail($thumbnailInfo, $thumbnailParams, true);
    }
751232
protected function getHtmlTitleFormatForPage(array $data)
    {
        if (empty($data['page']['title'])) {
            return $data['site']['name'];
        }

        return Str::replace($this->formats['page'], $data);
    }
1162080
public function resolve()
    {
        foreach ($this->sidebars as $name) {
            $sidebar = $this->resolver->resolve($name);

            $this->container->singleton($name, function () use ($sidebar) {
                return $sidebar;
            });
        }
    }
1166810
public function sidebars()
    {
        $sidebars = $this->sidebars;
        uasort($sidebars, [$this, 'sortSidebarsByPriority']);
        foreach ($sidebars as $sidebarIdent => $sidebar) {
            if (!$sidebar->active()) {
                continue;
            }

            if ($sidebar->template()) {
                $template = $sidebar->template();
            } else {
                $template = 'charcoal/admin/widget/form.sidebar';
            }

            $GLOBALS['widget_template'] = $template;
            yield $sidebarIdent => $sidebar;
            $GLOBALS['widget_template'] = '';
        }
    }
428285
public function view($view, $data = array(), $mergeData = array())
    {
        return $this->views->make($this->getThemeNamespace($view), $data, $mergeData);
    }
925367
public function sidebarMenuAuto()
    {
        $menu = false;

        if (!$menu || (isset($_GET['menu_cache']) && $_GET['menu_cache'] == 'false')) {
            $menu = new \Municipio\Helper\NavigationTree(array(
                'include_top_level' => !empty(get_field('nav_sub_include_top_level', 'option')) ? get_field('nav_sub_include_top_level', 'option') : false,
                'render' => get_field('nav_sub_render', 'option'),
                'depth' => get_field('nav_sub_depth', 'option') ? get_field('nav_sub_depth', 'option') : -1,
                'start_depth' => get_field('nav_primariy_second_level', 'option') ? 3 : 1,
                'classes' => 'nav-aside hidden-xs hidden-sm',
                'sidebar' => true
            ));
        }

        if ($menu->itemCount === 0) {
            return '';
        }

        return '<nav id="sidebar-menu">
                    ' . $menu->render(false) . '
                </nav>';
    }
835893
public function getTemplateFile($filename, $data)
    {
        $data['getRegion'] = function($name) { 
            return $this->getRegion($name); 
            }; // This is for mustache compatibility

        // Push the data into regions and then pass a pointer to this class to the layout
        // $this->setRegions($data);
        return parent::getTemplateFile($filename, $data); // Pass in layout object to template
    }
817784
public function render(Sidebar $sidebar)
    {
        $menu = $sidebar->getMenu();

        if ($menu->isAuthorized()) {
            $groups = [];
            foreach ($menu->getGroups() as $group) {
                $groups[] = (new IlluminateGroupRenderer($this->factory))->render($group);
            }

            return $this->factory->make($this->view, [
                'groups' => $groups
            ]);
        }
    }
558983
protected final function getWhere($data) {
        $con = [];
        foreach ($this->primaryKeys as $f) {
            if (array_key_exists($f, $data)) {
                if (isset($data[ $f ])) {
                    $con [ $f ] = $data [ $f ];
                } else {
                    $con [ $f . ' $' ] = null;
                }
            }
        }

        return $con;
    }