Add container grid to specified modules, in specified sidebars
@param  $markup The module markup
@return $module Module object
494076
public function addGridToSidebar($markup, $module)
    {
        $sidebars = apply_filters('Modularity/Module/Container/Sidebars', array());
        $modules = apply_filters('Modularity/Module/Container/Modules', array());
        $template = apply_filters('Modularity/Module/Container/Template', '<div class="container"><div class="grid"><div class="grid-xs-12">{{module-markup}}</div></div></div>');

        if (in_array($module->args['id'], $sidebars) && in_array($module->post_type, $modules)) {
            return str_replace('{{module-markup}}', $markup, $template);
        }

        return $markup;
    }
470061
public function sidebars($sidebars = [])
    {
        if (empty($sidebars)) {
            return $this;
        }

        if (function_exists('register_sidebar')) {
            foreach ($sidebars as $sidebar) {
                register_sidebar($sidebar);
            }
        }

        return $this;
    }
982450
protected function addContent(BaseMapper $mapper, $group)
    {
        // helper links
        $this->parseHelperLinks();

        // flat organization (DatagridMapper / ListMapper...)
        if (!$mapper instanceof BaseGroupedMapper) {
            //list actions
            $this->addActions();
            $this->removeActions();

            // options pre-treatment
            $options = [];
            if (isset($group['_options'])) {
                $options = $group['_options'];
                unset($group['_options']);
            }

            // content
            foreach ($group as $add => $opts) {
                $this->addField($mapper, $add, $opts);
            }

            // options
            if (isset($options['fieldsOrder'])) {
                $mapper->reorder($options['fieldsOrder']);
            }

            // extra templates
            $this->parseExtraTemplates();

            return $mapper;
        }

        $fcts = [
            'tabs' => $mapper instanceof ShowMapper ?
            ['getter' => 'getShowTabs', 'setter' => 'setShowTabs'] :
            ['getter' => 'getFormTabs', 'setter' => 'setFormTabs'],
            'groups' => $mapper instanceof ShowMapper ?
            ['getter' => 'getShowGroups', 'setter' => 'setShowGroups'] :
            ['getter' => 'getFormGroups', 'setter' => 'setFormGroups'],
        ];

        // if a grouped organization can be shapped
        // options
        $tabsOptions = null;
        if (isset($group['_options'])) {
            $tabsOptions = $group['_options'];
            unset($group['_options']);
        }

        // content
        foreach ($group as $tab => $tabcontent) { // loop on content...
            if (self::arrayDepth($tabcontent) < 1) {
                // direct add
                $this->addField($mapper, $tab, $tabcontent);
                $mapper->end()->end();
            } else {
                // groups/withs order
                $groupsOrder = null;
                if (isset($tabcontent['_options']['groupsOrder'])) {
                    $groupsOrder = $tabcontent['_options']['groupsOrder'];
                    unset($tabcontent['_options']['groupsOrder']);
                }

                $endgroup = $endtab = false;

                // tab
                if (!empty($tabcontent['_options']['hideTitle']) || $mapper instanceof ShowMapper && !$this->forceTabs) {
                    // display tabs as groups
                    $tabs = $this->{$fcts['tabs']['getter']}();
                    $groups = $this->{$fcts['groups']['getter']}();
                    if (isset($tabs[$tab])) {
                        $tabs[$tab]['auto_created'] = true;
                        $this->{$fcts['tabs']['setter']}($tabs);

                        foreach ($groups as $groupkey => $group) {
                            if (!isset($groups[$group['name']])) {
                                $groups[$group['name']] = $group;
                                unset($groups[$groupkey]);
                            }
                        }
                        $this->{$fcts['groups']['setter']}($groups);
                    }
                } else {
                    $mapper->tab($tab, isset($tabcontent['_options']) ? $tabcontent['_options'] : []);
                    $endtab = true;
                }

                // adding count of collections items in tab
                if (isset($tabcontent['_options']['countChildItems']) && is_array($tabcontent['_options']['countChildItems'])) {
                    $tabs = $this->{$fcts['tabs']['getter']}();
                    if (strpos($tabs[$tab]['class'], 'countable-tab') === false) {
                        $tabs[$tab]['class'] .= ' countable-tab';

                        foreach ($tabcontent['_options']['countChildItems'] as $fieldToCount) {
                            if (strpos($tabs[$tab]['class'], 'count-' . $fieldToCount) === false) {
                                $tabs[$tab]['class'] .= ' count-' . $fieldToCount;
                            }
                        }

                        $this->{$fcts['tabs']['setter']}($tabs);
                    }
                }

                // clearing tabcontent options
                if (isset($tabcontent['_options'])) {
                    unset($tabcontent['_options']);
                }

                $finalOrder = null;

                // with
                if (self::arrayDepth($tabcontent) > 0) {
                    foreach ($tabcontent as $with => $withcontent) {
                        $opt = isset($withcontent['_options']) ? $withcontent['_options'] : [];
                        $finalOrder = (isset($opt['fieldsOrder']) ? $opt['fieldsOrder'] : null);

                        if (empty($opt['hideTitle'])) {
                            $endtab = true;
                            $endgroup = true;
                            $mapper->with($with, $opt);
                        }
                        if (isset($withcontent['_options'])) {
                            unset($withcontent['_options']);
                        }

                        // final adds
                        if (self::arrayDepth($withcontent) > 0) {
                            foreach ($withcontent as $name => $options) {
                                $fieldDescriptionOptions = [];
                                if (isset($options['_options'])) {
                                    $fieldDescriptionOptions = $options['_options'];
                                    unset($options['_options']);
                                }
                                $this->addField($mapper, $name, $options, $fieldDescriptionOptions);
                                $endgroup = $endtab = true;
                            }
                        }

                        if ($finalOrder != null) {
                            $mapper->reorder($finalOrder);
                        }

                        if ($endgroup) {
                            $mapper->end();
                        }
                    }
                }

                // order groups / withs (using tabs, because they are prioritary at the end)
                if (isset($groupsOrder)) {
                    // preparing
                    $otabs = $mapper->getAdmin()->{$fcts['tabs']['getter']}();
                    $groups = $mapper->getAdmin()->{$fcts['groups']['getter']}();

                    // pre-ordering
                    $newgroups = [];
                    $buf = empty($otabs[$tab]['auto_created']) ? "$tab." : '';
                    foreach ($groupsOrder as $groupname) {
                        if (isset($otabs[$tab]) && in_array("$buf$groupname", $otabs[$tab]['groups'])) {
                            $newgroups[] = "$buf$groupname";
                        }
                    }

                    // ordering tabs
                    foreach (empty($otabs[$tab]['groups']) ? [] : $otabs[$tab]['groups'] as $groupname) {
                        if (!in_array($groupname, $newgroups)) {
                            $newgroups[] = $groupname;
                        }
                    }
                    $otabs[$tab]['groups'] = $newgroups;

                    // "persisting"
                    $mapper->getAdmin()->{$fcts['tabs']['setter']}($otabs);
                }

                if ($endtab) {
                    $mapper->end();
                }
            }
        }

        // ordering tabs
        if (isset($tabsOptions['tabsOrder']) && $tabs = $this->{$fcts['tabs']['getter']}()) {
            $newtabs = [];
            foreach ($tabsOptions['tabsOrder'] as $tabname) {
                if (isset($tabs[$tabname])) {
                    $newtabs[$tabname] = $tabs[$tabname];
                }
            }
            foreach ($tabs as $tabname => $tab) {
                if (!isset($newtabs[$tabname])) {
                    $newtabs[$tabname] = $tab;
                }
            }
            $this->{$fcts['tabs']['setter']}($newtabs);
        }

        // ordering the ShowMapper
        if ($mapper instanceof ShowMapper) {
            foreach ($group as $tabName => $tabContent) {
                $tabOptions = null;
                if (isset($tabContent['_options'])) {
                    $tabOptions = $tabContent['_options'];
                    unset($tabContent['_options']);
                }

                if (isset($tabOptions['groupsOrder'])) {
                    $tabs = $this->{$fcts['tabs']['getter']}();
                    $groups = $this->{$fcts['groups']['getter']}();

                    $groupOrder = $tabOptions['groupsOrder'];

                    $properOrderedArray = array_merge(array_flip($groupOrder), $groups);

                    $this->{$fcts['groups']['setter']}($properOrderedArray);
                    $this->{$fcts['tabs']['setter']}($tabs);
                }
            }
        }

        return $mapper;
    }
46541
public function getLayoutSelectItems($colPos, $gridColPos = 0, $containerId = 0, $pageId = 0)
    {
        $allowed = ['*' => '*'];
        $disallowed = [];
        $selectItems = [];
        if ($containerId > 0) {
            $container = $this->cacheCurrentParent((int)$containerId, true);
            if (!empty($container)) {
                $containerLayout = $this->layoutSetup[$container['tx_gridelements_backend_layout']];
                $allowed = $containerLayout['allowed'][$gridColPos]['tx_gridelements_backend_layout'];
                $disallowed = $containerLayout['disallowed'][$gridColPos]['tx_gridelements_backend_layout'];
            }
        } elseif ($pageId > 0) {
            $pageLayout = Helper::getInstance()->getSelectedBackendLayout($pageId);
            if (!empty($pageLayout)) {
                $allowed = $pageLayout['allowed'][$colPos]['tx_gridelements_backend_layout'];
                $disallowed = $pageLayout['disallowed'][$colPos]['tx_gridelements_backend_layout'];
            }
        }
        foreach ($this->layoutSetup as $layoutId => $item) {
            if ((
                    (int)$colPos === -1 &&
                    $item['top_level_layout']
                ) ||
                (
                    !empty($allowed) &&
                    !isset($allowed['*']) &&
                    !isset($allowed[$layoutId])
                ) ||
                (
                    !empty($disallowed) &&
                    (
                        isset($disallowed['*']) ||
                        isset($disallowed[$layoutId])
                    )
                )) {
                continue;
            }
            $icon = 'gridelements-default';
            if ($item['iconIdentifier']) {
                $icon = $item['iconIdentifier'];
            } elseif (!empty($item['icon'])) {
                if (is_array($item['icon']) && !empty($item['icon'][0])) {
                    $icon = $item['icon'][0];
                } else {
                    $icon = $item['icon'];
                }
                if (StringUtility::beginsWith($icon, '../')) {
                    $icon = PATH_site . str_replace('../', '', $icon);
                }
            }
            $selectItems[] = [$this->languageService->sL($item['title']), $layoutId, $icon];
        }

        return $selectItems;
    }
244875
public function addElement(BaseElement $element): ContainerElement
    {
        $element->parent = $this;
        $this->children[] = $element;
        if ($element instanceof ContainerElement) {
            return $element;
        }

        return $this;
    }
1211043
public static function newDocumentHTML($markup = null, $charset = null) 
    {
        $contentType = $charset
        ? ";charset=$charset"
        : '';
        return self::newDocument($markup, "text/html{$contentType}");
    }
36337
private function addDoctrineSection()
    {
        $tree = new TreeBuilder();
        $node = $tree->root('doctrine');

        foreach (array('metadata_cache', 'result_cache', 'query_cache') as $type) {
            $node->children()
                ->arrayNode($type)
                    ->canBeUnset()
                    ->children()
                        ->scalarNode('pool')->isRequired()->end()
                        ->scalarNode('prefix')->defaultValue('lmbd')->end()
                    ->end()
                    ->fixXmlConfig('entity_manager')
                    ->children()
                        ->arrayNode('entity_managers')
                            ->defaultValue(array())
                            ->beforeNormalization()->ifString()->then(function($v) { return (array) $v; })->end()
                            ->prototype('scalar')->end()
                        ->end()
                    ->end()
                    ->fixXmlConfig('document_manager')
                    ->children()
                        ->arrayNode('document_managers')
                            ->defaultValue(array())
                            ->beforeNormalization()->ifString()->then(function($v) { return (array) $v; })->end()
                            ->prototype('scalar')->end()
                        ->end()
                    ->end()
                ->end()
            ->end();
        }

        return $node;
    }
461606
public function addContentItems($items = [])
    {
        // Loop on each item.
        collect($items)->each(function ($item) {
            // Add each content to the Container.
            $this->addSingleContentItem($item);
        });

        // Return object.
        return $this;
    }
1130511
public function add_meta_boxes() {

		$pod = array(
			'name' => $this->object_type,
			'type' => 'post_type',
		);

		if ( isset( PodsMeta::$post_types[ $pod['name'] ] ) ) {
			return;
		}

		if ( ! function_exists( 'get_page_templates' ) ) {
			include_once ABSPATH . 'wp-admin/includes/theme.php';
		}

		$page_templates = apply_filters( 'pods_page_templates', get_page_templates() );

		$page_templates[ __( '-- Page Template --', 'pods' ) ] = '';

		$page_templates[ __( 'Custom (uses only Pod Page content)', 'pods' ) ] = '_custom';

		if ( ! in_array( 'pods.php', $page_templates, true ) && locate_template( array( 'pods.php', false ) ) ) {
			$page_templates[ __( 'Pods (Pods Default)', 'pods' ) ] = 'pods.php';
		}

		if ( ! in_array( 'page.php', $page_templates, true ) && locate_template( array( 'page.php', false ) ) ) {
			$page_templates[ __( 'Page (WP Default)', 'pods' ) ] = 'page.php';
		}

		if ( ! in_array( 'index.php', $page_templates, true ) && locate_template( array( 'index.php', false ) ) ) {
			$page_templates[ __( 'Index (WP Fallback)', 'pods' ) ] = 'index.php';
		}

		ksort( $page_templates );

		$page_templates = array_flip( $page_templates );

		$fields = array(
			array(
				'name'  => 'page_title',
				'label' => __( 'Page Title', 'pods' ),
				'type'  => 'text',
			),
			array(
				'name'          => 'code',
				'label'         => __( 'Page Code', 'pods' ),
				'type'          => 'code',
				'attributes'    => array(
					'id' => 'content',
				),
				'label_options' => array(
					'attributes' => array(
						'for' => 'content',
					),
				),
			),
			array(
				'name'  => 'precode',
				'label' => __( 'Page Precode', 'pods' ),
				'type'  => 'code',
				'help'  => __( 'Precode will run before your theme outputs the page. It is expected that this value will be a block of PHP. You must open the PHP tag here, as we do not open it for you by default.', 'pods' ),
			),
			array(
				'name'  => 'page_template',
				'label' => __( 'Page Template', 'pods' ),
				'type'  => 'pick',
				'data'  => $page_templates,
			),
		);

		pods_group_add( $pod, __( 'Page', 'pods' ), $fields, 'normal', 'high' );

		$associated_pods = array(
			0 => __( '-- Select a Pod --', 'pods' ),
		);

		$all_pods = pods_api()->load_pods( array( 'names' => true ) );

		if ( ! empty( $all_pods ) ) {
			foreach ( $all_pods as $pod_name => $pod_label ) {
				$associated_pods[ $pod_name ] = $pod_label . ' (' . $pod_name . ')';
			}
		} else {
			$associated_pods[0] = __( 'None Found', 'pods' );
		}

		$fields = array(
			array(
				'name'       => 'pod',
				'label'      => __( 'Associated Pod', 'pods' ),
				'default'    => 0,
				'type'       => 'pick',
				'data'       => $associated_pods,
				'dependency' => true,
			),
			array(
				'name'        => 'pod_slug',
				'label'       => __( 'Wildcard Slug', 'pods' ),
				'help'        => __( 'Setting the Wildcard Slug is an easy way to setup a detail page. You can use the special tag {@url.2} to match the *third* level of the URL of a Pod Page named "first/second/*" part of the pod page. This is functionally the same as using pods_v_sanitized( 2, "url" ) in PHP.', 'pods' ),
				'type'        => 'text',
				'excludes-on' => array( 'pod' => 0 ),
			),
		);

		pods_group_add( $pod, __( 'Pod Association', 'pods' ), $fields, 'normal', 'high' );

		$fields = array(
			array(
				'name'       => 'admin_only',
				'label'      => __( 'Restrict access to Admins?', 'pods' ),
				'default'    => 0,
				'type'       => 'boolean',
				'dependency' => true,
			),
			array(
				'name'       => 'restrict_role',
				'label'      => __( 'Restrict access by Role?', 'pods' ),
				'help'       => array(
					__( '<h6>Roles</h6> Roles are assigned to users to provide them access to specific functionality in WordPress. Please see the Roles and Capabilities component in Pods for an easy tool to add your own roles and edit existing ones.', 'pods' ),
					'http://codex.wordpress.org/Roles_and_Capabilities',
				),
				'default'    => 0,
				'type'       => 'boolean',
				'dependency' => true,
			),
			array(
				'name'              => 'roles_allowed',
				'label'             => __( 'Role(s) Allowed', 'pods' ),
				'type'              => 'pick',
				'pick_object'       => 'role',
				'pick_format_type'  => 'multi',
				'pick_format_multi' => 'autocomplete',
				'pick_ajax'         => false,
				'default'           => '',
				'depends-on'        => array(
					'restrict_role' => true,
				),
			),
			array(
				'name'       => 'restrict_capability',
				'label'      => __( 'Restrict access by Capability?', 'pods' ),
				'help'       => array(
					__( '<h6>Capabilities</h6> Capabilities denote access to specific functionality in WordPress, and are assigned to specific User Roles. Please see the Roles and Capabilities component in Pods for an easy tool to add your own capabilities and roles.', 'pods' ),
					'http://codex.wordpress.org/Roles_and_Capabilities',
				),
				'default'    => 0,
				'type'       => 'boolean',
				'dependency' => true,
			),
			array(
				'name'              => 'capability_allowed',
				'label'             => __( 'Capability Allowed', 'pods' ),
				'type'              => 'pick',
				'pick_object'       => 'capability',
				'pick_format_type'  => 'multi',
				'pick_format_multi' => 'autocomplete',
				'pick_ajax'         => false,
				'default'           => '',
				'depends-on'        => array(
					'restrict_capability' => true,
				),
			),
			array(
				'name'       => 'restrict_redirect',
				'label'      => __( 'Redirect if Restricted?', 'pods' ),
				'default'    => 0,
				'type'       => 'boolean',
				'dependency' => true,
			),
			array(
				'name'       => 'restrict_redirect_login',
				'label'      => __( 'Redirect to WP Login page', 'pods' ),
				'default'    => 0,
				'type'       => 'boolean',
				'dependency' => true,
				'depends-on' => array(
					'restrict_redirect' => true,
				),
			),
			array(
				'name'       => 'restrict_redirect_url',
				'label'      => __( 'Redirect to a Custom URL', 'pods' ),
				'default'    => '',
				'type'       => 'text',
				'depends-on' => array(
					'restrict_redirect'       => true,
					'restrict_redirect_login' => false,
				),
			),
		);

		pods_group_add( $pod, __( 'Restrict Access', 'pods' ), $fields, 'normal', 'high' );
	}
233784
public AnnotatedTextBuilder addMarkup(String markup) {
    parts.add(new TextPart(markup, TextPart.Type.MARKUP));
    return this;
  }
80080
public function buildTreeHtml($keys = [], $items = [], $config = [], $selected = []) {
        $configDefault = [
            'id' => 'nestable',
            'class' => 'dd',
            'containerClass' => 'dd-list',
            'itemClass' => 'dd-item',
            'labelClass' => 'dd-handle',
            'actions' => [],
        ];
        $config = array_merge($configDefault, $config);

        // root items
        $asRoot = false;
        if (empty($items)) {
            $asRoot = true;
            $items[] = [
                '_id' => $this->owner->getAttribute('_id'),
                'name' => $this->owner->getAttribute('name'),
                'lft' => $this->owner->getAttribute($this->leftAttribute),
                'rgt' => $this->owner->getAttribute($this->rightAttribute),
            ];
            $children = $this->children()->all();
            foreach ($children as $child) {
                $items[] = [
                    '_id' => $child->owner->getAttribute('_id'),
                    'name' => $child->owner->getAttribute('name'),
                    $this->leftAttribute => $child->owner->getAttribute($this->leftAttribute),
                    $this->rightAttribute => $child->owner->getAttribute($this->rightAttribute),
                ];
            }
            $keys = $this->buildTreeKeys($items);
        }
        
        $list = Html::beginTag('ol', ['class' => $config['containerClass']]);
        foreach ($keys as $key => $row) {
            if (isset($config['actions'])) {
                $actions = str_replace ('{_id}', $items[$key]['_id'], $config['actions']);

                if (is_array($selected) && in_array($items[$key]['_id'], $selected)) {
                    $actions = str_replace ('{check}', 'checked', $actions);
                }
            }

            if (count($row)) {
                $list .= Html::tag('li', $actions.'<div class="' . $config['labelClass'] . '">' . $items[$key]['name']  . '</div>' . $this->buildTreeHtml($row, $items, $config, $selected), ['class' => $config['itemClass'], 'data-id' => $items[$key]['_id']]);
            } else {
                $list .= Html::tag('li', $actions.'<div class="' . $config['labelClass'] . '">' . $items[$key]['name'] . '</div>', ['class' => $config['itemClass'], 'data-id' => $items[$key]['_id']]);
            }
        }
        $list .= Html::endTag('ol');

//        if (strpos($list, Html::beginTag('li', ['class' => $config['itemClass'], 'data-id' => $items[$key]['_id']])) === false) {
//            $list = '';
//        }
        
        if ($asRoot){
            $list = Html::tag('div', $list, ['id' => $config['id'], 'class' => $config['class']]);
        }
        return $list;
    }
393989
public function metaBoxTemplateAreas()
    {
	global $wp_registered_sidebars;
	global $modularityOptions;

	usort($wp_registered_sidebars, function ($a, $b) {
	    return $a['name'] > $b['name'];
	});

	$coreTemplates = \Modularity\Helper\Wp::getCoreTemplates();
	$coreTemplates = apply_filters('Modularity/CoreTemplatesInTheme', $coreTemplates);
	$customTemplates = get_page_templates();
	$templates = array_merge($coreTemplates, $customTemplates);

	include MODULARITY_TEMPLATE_PATH . 'options/partials/modularity-template-areas.php';
    }
475289
public function addToFormContainer(Nette\Forms\Container $container)
	{
		$container->addText($this->key, $this->name);

		$this->addAttributes($container[$this->key]);

		if ($this->getPlaceholder()) {
			$container[$this->key]->setAttribute('placeholder', $this->getPlaceholder());
		}
	}
1304114
public function convert($markdown)
    {
        $root = new Container();

        $this->inlineParser = new InlineParser($this->links, $this->titles);
        $parser = $this->buildParserStack();

        $text = new Text($markdown);
        $this->prepare($text);

        $parser->parseBlock($text, $root);

        $this->inlineParser->parse();

        return $root;
    }
518321
public function render($markdown)
    {
        $ast = $this->docParser->parse($markdown);
        return $this->cliRenderer->renderBlock($ast);
    }
815310
public function panelHeading($html, $options = array()) {
		$defaults = array('class' => '');
		$options = array_merge($defaults, $options);
		$options = $this->addClass($options, 'panel-heading');
		return $this->tag('div', $html, $options);
	}
189420
public function parse($markdown)
    {
        $document = $this->parser->parse($markdown);
        $html = $this->renderer->renderBlock($document);

        return $html;
    }