regionhalland / region-halland-plugin-parent-page-and-siblings-with-current-childs
前端插件,返回当前页面的父页面 + 所有同级页面 + 子页面
v1.3.0
2020-11-03 12:44 UTC
This package is auto-updated.
Last update: 2024-09-29 05:42:44 UTC
README
如何使用Region Halland的插件"RhParentPageAndSiblingsWithCurrentChilds"
以下是使用插件"RhParentPageAndSiblingsWithCurrentChilds"的说明。
使用范围
此插件创建一个数组(),包含父页面 + 所有同级页面 + 当前页面的子页面
许可证模型
此插件使用许可证模型GPL-3.0。您可以通过附带的文件了解更多关于此许可证模型的信息
LICENSE (https://regionhalland.visualstudio.com/public.RhWpPlugIns/_git/RhParentPageAndSiblingsWithCurrentChilds?path=%2FLICENSE&version=GBmaster)
安装和激活
A) Hämta pluginen via Git eller läs in det med Composer
B) Installera Region Hallands plugin i Wordpress plugin folder
C) Aktivera pluginet inifrån Wordpress admin
通过Git获取插件
git https://regionhalland.visualstudio.com/public.RhWpPlugIns/_git/RhParentPageAndSiblingsWithCurrentChilds
通过composer导入插件
这些部分需要添加到您的composer文件中
Repositories = 存储插件的位置,在本例中为github
"repositories": [
{
"type": "vcs",
"url": "https://regionhalland.visualstudio.com/public.RhWpPlugIns/_git/RhParentPageAndSiblingsWithCurrentChilds"
},
],
Require = 指定要使用的插件版本,在本例中为1.0.0
注意!请调整以获取当前版本。
"require": {
"regionhalland/region-halland-plugin-parent-page-and-siblings-with-current-childs": "1.0.0"
},
通过"Blade"循环页面
@if(function_exists('get_region_halland_parent_page_and_siblings_with_current_childs'))
@php($myPages = get_region_halland_parent_page_and_siblings_with_current_childs())
@if(isset($myPages))
<a href="{{ $myPages['parent']['parent_url'] }}">
{{ $myPages['parent']['parent_title'] }}
</a><br>
@if (!empty($myPages['siblings']))
@foreach ($myPages['siblings'] as $mySiblings)
@if($mySiblings['sibling_active'] == 1)
<a href="{{ $mySiblings['sibling_url'] }}">
<strong>{{ $mySiblings['sibling_title'] }}</strong>
</a><br>
@else
<a href="{{ $mySiblings['sibling_url'] }}">
{{ $mySiblings['sibling_title'] }}
</a><br>
@endif
@if($mySiblings['sibling_active'] == 1)
@if($mySiblings['sibling_childs_count'] != 0)
@foreach ($mySiblings['sibling_childs'] as $myChilds)
<a href="{{ $myChilds['child_url'] }}">
{{ $myChilds['child_title'] }}
</a><br>
@endforeach
@endif
@endif
@endforeach
@endif
@endif
@endif
请注意,此功能可以通过"true"参数调用,以仅在子页面而非顶级页面获取数据。
数组的示例
array (size=2)
'parent' =>
array (size=2)
'parent_title' => string 'Smittskydd' (length=10)
'parent_url' => string 'http://dev-vardgivare.local/behandlingsstod/smittskydd/' (length=55)
'siblings' =>
array (size=9)
0 =>
array (size=6)
'sibling_id' => int 4633
'sibling_title' => string 'Strama' (length=6)
'sibling_url' => string 'http://dev-vardgivare.local/behandlingsstod/smittskydd/strama/' (length=62)
'sibling_active' => int 1
'sibling_childs_count' => int 1
'sibling_childs' =>
array (size=1)
0 =>
array (size=2)
'child_title' => string 'Informationsmaterial Strama' (length=27)
'child_url' => string 'http://dev-vardgivare.local/behandlingsstod/smittskydd/strama/bvc-stramautbildning/' (length=83)
'sibling_page_type' => string 'page' (length=4)
1 =>
array (size=6)
'sibling_id' => int 11992
'sibling_title' => string 'corona' (length=6)
'sibling_url' => string 'http://dev-vardgivare.local/behandlingsstod/smittskydd/corona/' (length=62)
'sibling_active' => int 0
'sibling_childs_count' => int 0
'sibling_childs' => string '' (length=0)
'sibling_page_type' => string 'page' (length=4)
2 =>
array (size=6)
'sibling_id' => int 4717
'sibling_title' => string 'Tuberkulos' (length=10)
'sibling_url' => string 'http://dev-vardgivare.local/behandlingsstod/smittskydd/tuberkulos/' (length=66)
'sibling_active' => int 0
'sibling_childs_count' => int 0
'sibling_childs' => string '' (length=0)
'sibling_page_type' => string 'section' (length=6)
3 =>
array (size=6)
'sibling_id' => int 4478
'sibling_title' => string 'Vad är det som går?' (length=21)
'sibling_url' => string 'http://dev-vardgivare.local/behandlingsstod/smittskydd/vad-ar-det-som-gar/' (length=74)
'sibling_active' => int 0
'sibling_childs_count' => int 0
'sibling_childs' => string '' (length=0)
'sibling_page_type' => string 'page' (length=4)
4 =>
array (size=6)
'sibling_id' => int 4745
'sibling_title' => string 'Vaccinationer' (length=13)
'sibling_url' => string 'http://dev-vardgivare.local/behandlingsstod/smittskydd/vaccinationer/' (length=69)
'sibling_active' => int 0
'sibling_childs_count' => int 0
'sibling_childs' => string '' (length=0)
'sibling_page_type' => string 'page' (length=4)
5 =>
array (size=6)
'sibling_id' => int 4499
'sibling_title' => string 'Anmälningspliktiga sjukdomar' (length=29)
'sibling_url' => string 'http://dev-vardgivare.local/behandlingsstod/smittskydd/anmalningspliktiga-sjukdomar/' (length=84)
'sibling_active' => int 0
'sibling_childs_count' => int 0
'sibling_childs' => string '' (length=0)
'sibling_page_type' => string 'page' (length=4)
6 =>
array (size=6)
'sibling_id' => int 4512
'sibling_title' => string 'Faktablad och PM' (length=16)
'sibling_url' => string 'http://dev-vardgivare.local/behandlingsstod/smittskydd/faktablad-och-pm/' (length=72)
'sibling_active' => int 0
'sibling_childs_count' => int 0
'sibling_childs' => string '' (length=0)
'sibling_page_type' => string 'page' (length=4)
7 =>
array (size=6)
'sibling_id' => int 4583
'sibling_title' => string 'Influensa och influensavaccination' (length=34)
'sibling_url' => string 'http://dev-vardgivare.local/behandlingsstod/smittskydd/influensa-och-influensavaccination/' (length=90)
'sibling_active' => int 0
'sibling_childs_count' => int 0
'sibling_childs' => string '' (length=0)
'sibling_page_type' => string 'section' (length=6)
8 =>
array (size=6)
'sibling_id' => int 70
'sibling_title' => string 'Kontaktuppgifter smittskydd' (length=27)
'sibling_url' => string 'http://dev-vardgivare.local/behandlingsstod/smittskydd/kontaktuppgifter-smittskydd/' (length=83)
'sibling_active' => int 0
'sibling_childs_count' => int 0
'sibling_childs' => string '' (length=0)
'sibling_page_type' => string 'page' (length=4)
版本历史
1.3.0
- 添加了page-type
1.2.0
- 添加了一个参数,以不在没有父级的页面上返回数据
1.1.0
- 添加了通过Packagist发布的工作流程
1.0.0
- 第一个版本