Skip to content
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

feature/Headerbild syns inte p enskilda platser CU 865czxqet #652

11 changes: 5 additions & 6 deletions library/AcfFields/json/content-type-place.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,24 @@
"class": "",
"id": ""
},
"acfe_save_meta": 0,
"center_lat": "56.042834",
"center_lng": "12.7009283,17",
"center_lng": "12.7009283",
"zoom": 11,
"height": 300
}
],
"location": [
[
{
"param": "purpose",
"param": "content_type",
"operator": "==",
"value": "place"
}
],
[
},
{
"param": "post_type",
"operator": "==",
"value": "place"
"value": "all"
}
]
],
Expand Down
77 changes: 77 additions & 0 deletions library/AcfFields/json/options-content-types.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
[{
"key": "group_63e3852d91646",
"title": "Content types",
"fields": [
{
"key": "field_63e3852d5d07b",
"label": "Content type",
"name": "content_types",
"aria-label": "",
"type": "select",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "50",
"class": "",
"id": ""
},
"acfe_save_meta": 0,
"choices": [],
"default_value": false,
"return_format": "value",
"multiple": 0,
"allow_null": 0,
"ui": 0,
"ajax": 0,
"placeholder": "",
"allow_custom": 0,
"search_placeholder": ""
},
{
"key": "field_63e3a2215d07c",
"label": "Use template",
"name": "use_content_type_template",
"aria-label": "",
"type": "true_false",
"instructions": "Select to override the default post template for this post type.",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "50",
"class": "",
"id": ""
},
"acfe_save_meta": 0,
"message": "Use content type template",
"default_value": 0,
"ui": 0,
"ui_on_text": "",
"ui_off_text": ""
}
],
"location": [
[
{
"param": "content_type",
"operator": "==",
"value": "event"
}
]
],
"menu_order": 0,
"position": "normal",
"style": "default",
"label_placement": "left",
"instruction_placement": "label",
"hide_on_screen": "",
"active": false,
"description": "",
"show_in_rest": 0,
"acfe_display_title": "",
"acfe_autosync": "",
"acfe_form": 0,
"acfe_meta": "",
"acfe_note": ""
}]

56 changes: 0 additions & 56 deletions library/AcfFields/json/purpose-place.json

This file was deleted.

11 changes: 5 additions & 6 deletions library/AcfFields/php/content-type-place.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,24 @@
'class' => '',
'id' => '',
),
'acfe_save_meta' => 0,
'center_lat' => '56.042834',
'center_lng' => '12.7009283,17',
'center_lng' => '12.7009283',
'zoom' => 11,
'height' => 300,
),
),
'location' => array(
0 => array(
0 => array(
'param' => 'purpose',
'param' => 'content_type',
'operator' => '==',
'value' => 'place',
),
),
1 => array(
0 => array(
1 => array(
'param' => 'post_type',
'operator' => '==',
'value' => 'place',
'value' => 'all',
),
),
),
Expand Down
81 changes: 81 additions & 0 deletions library/AcfFields/php/options-content-types.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?php

if (function_exists('acf_add_local_field_group')) {
acf_add_local_field_group(array(
'key' => 'group_63e3852d91646',
'title' => __('Content types', 'municipio'),
'fields' => array(
0 => array(
'key' => 'field_63e3852d5d07b',
'label' => __('Content type', 'municipio'),
'name' => 'content_types',
'aria-label' => '',
'type' => 'select',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '50',
'class' => '',
'id' => '',
),
'acfe_save_meta' => 0,
'choices' => array(
),
'default_value' => false,
'return_format' => 'value',
'multiple' => 0,
'allow_null' => 0,
'ui' => 0,
'ajax' => 0,
'placeholder' => '',
'allow_custom' => 0,
'search_placeholder' => '',
),
1 => array(
'key' => 'field_63e3a2215d07c',
'label' => __('Use template', 'municipio'),
'name' => 'use_content_type_template',
'aria-label' => '',
'type' => 'true_false',
'instructions' => __('Select to override the default post template for this post type.', 'municipio'),
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '50',
'class' => '',
'id' => '',
),
'acfe_save_meta' => 0,
'message' => __('Use content type template', 'municipio'),
'default_value' => 0,
'ui' => 0,
'ui_on_text' => '',
'ui_off_text' => '',
),
),
'location' => array(
0 => array(
0 => array(
'param' => 'content_type',
'operator' => '==',
'value' => 'event',
),
),
),
'menu_order' => 0,
'position' => 'normal',
'style' => 'default',
'label_placement' => 'left',
'instruction_placement' => 'label',
'hide_on_screen' => '',
'active' => false,
'description' => '',
'show_in_rest' => 0,
'acfe_display_title' => '',
'acfe_autosync' => '',
'acfe_form' => 0,
'acfe_meta' => '',
'acfe_note' => '',
));
}
Expand Down
59 changes: 0 additions & 59 deletions library/AcfFields/php/purpose-place.php

This file was deleted.

21 changes: 10 additions & 11 deletions library/Admin/Acf/LocationRulesContentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class LocationRulesContentType extends \ACF_Location // @codingStandardsIgnoreLi
public function initialize()
{
$this->name = 'content_type';
$this->label = __("ContentType", 'municipio');
$this->label = __("Content type", 'municipio');
$this->category = 'post';
$this->object_type = 'post';
}
Expand All @@ -30,21 +30,20 @@ public function match($rule, $screen, $field_group)
} else {
return false;
}

// Compare the post attribute to rule value.
$contentTypes = \Municipio\Helper\ContentType::getContentType($type, true);
if (!empty($contentTypes)) {
foreach ($contentTypes as $contentType) {
$result = ($contentType->key === $rule['value']);
$returnResult = $result;
// Return result taking into account the operator type.
if ($rule['operator'] == '!=') {
$returnResult = !$result;
}
$contentType = \Municipio\Helper\ContentType::getContentType($type, true);

if (is_object($contentType)) {
$result = ($contentType->getKey() === $rule['value']);
$returnResult = $result;
// Return result taking into account the operator type.
if ($rule['operator'] == '!=') {
$returnResult = !$result;
}
} else {
$returnResult = false;
}

return $returnResult;
}
}
4 changes: 2 additions & 2 deletions library/Admin/Options/ContentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public function init()

if ($this->renderFieldGroups($postTypes)) {
acf_add_options_sub_page(array(
'page_title' => __('ContentType templates', 'municipio'),
'menu_title' => __('ContentTypes', 'municipio'),
'page_title' => __('Content types', 'municipio'),
'menu_title' => __('Content types', 'municipio'),
'parent_slug' => 'themes.php',
'capability' => 'administrator',
'menu_slug' => 'acf-options-content-type'
Expand Down
Loading
Loading