Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request #71 from helsingborg-stad/fix/status-not-showing
Browse files Browse the repository at this point in the history
fix: status not showing
  • Loading branch information
NiclasNorin authored Mar 1, 2024
2 parents c305efb + 4de1b89 commit eb72280
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
25 changes: 15 additions & 10 deletions source/php/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,8 @@ public function __construct()
new Shortcodes\ExtendedQuote\ExtendedQuote();
new Shortcodes\PostTypeLink\PostTypeLink();

// Add view paths
add_filter('Municipio/blade/view_paths', array($this, 'addViewPaths'), 2, 1);

add_action('template_redirect', array($this, 'addViewPaths'));
add_action('wp_enqueue_scripts', array($this, 'enqueueStyles'));

add_action('wp_enqueue_scripts', array($this, 'enqueueStyles'));
add_action('wp_enqueue_scripts', array($this, 'enqueueScripts'));
add_filter('language_attributes', array($this, 'wpBodyClasses'), 999);
Expand Down Expand Up @@ -120,15 +117,23 @@ public function enqueueScripts()

/**
* Add searchable blade template paths
* @param array $array Template paths
* @return array Modified template paths
*
* @return void
*/
public function addViewPaths($array)
public function addViewPaths(): void
{
// Add view path first in the list
array_unshift($array, PROJECTMANAGERINTEGRATION_VIEW_PATH);
$postTypes = [
\ProjectManagerIntegration\PostTypes\Challenge::$postType,
\ProjectManagerIntegration\PostTypes\Platform::$postType,
\ProjectManagerIntegration\PostTypes\Project::$postType
];

return $array;
if (in_array(get_post_type(), $postTypes) && defined('PROJECTMANAGERINTEGRATION_VIEW_PATH')) {
add_filter('Municipio/viewPaths', function ($array) {
array_unshift($array, PROJECTMANAGERINTEGRATION_VIEW_PATH);
return $array;
}, 2, 1);
}
}

public function modifyPostTypes($args, $postType)
Expand Down
7 changes: 6 additions & 1 deletion source/php/Helper/Blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace ProjectManagerIntegration\Helper;

use BadFunctionCallException;
use ComponentLibrary\Init as ComponentLibraryInit;

class Blade
{
Expand All @@ -21,6 +22,10 @@ public static function render(string $view, array $data): string
);
}

return \render_blade_view($view, $data, $viewPaths);
$componentLibrary = new ComponentLibraryInit([]);
$bladeService = $componentLibrary->getEngine();
$markup = $bladeService->makeView($view, $data, [], $viewPaths)->render();

return $markup;
}
}
4 changes: 2 additions & 2 deletions source/php/PostTypes/Platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class Platform
{
public $postType = 'platform';
public static $postType = 'platform';

public function __construct()
{
Expand Down Expand Up @@ -32,7 +32,7 @@ public function registerPostType()
);

$postType = new \ProjectManagerIntegration\Helper\PostType(
$this->postType,
self::$postType,
__('Platform', PROJECTMANAGERINTEGRATION_TEXTDOMAIN),
__('Platforms', PROJECTMANAGERINTEGRATION_TEXTDOMAIN),
$args,
Expand Down

0 comments on commit eb72280

Please sign in to comment.