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

Sage10 support #112

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
8b6cb30
remove unused files && add sage10 support
danlapteacru Jun 3, 2020
4da191d
sageflbuilder container to roots/app
danlapteacru Jun 3, 2020
06ba097
remove richtext
danlapteacru Jun 4, 2020
b7959f6
remove aliases
danlapteacru Jun 8, 2020
38c1c78
get compiled
danlapteacru Jun 9, 2020
81383f6
remove abstract functions
danlapteacru Jun 9, 2020
6e405f8
Remove redundant packages. Min stab dev
codepuncher Jun 10, 2020
42835ef
add ServiceProvider
danlapteacru Jun 11, 2020
f37c20f
sage flbuilder themer support
danlapteacru Jun 12, 2020
543ac81
remove redundant functions
danlapteacru Jun 12, 2020
6b52721
add layout
danlapteacru Jun 15, 2020
7317763
change views dir
danlapteacru Jun 15, 2020
fe18cd9
changes
danlapteacru Jun 15, 2020
1a194d5
double quotes to single quotes
danlapteacru Jun 16, 2020
af30e1b
cr php:^7.4
codepuncher Jul 28, 2020
4657bd7
Pass data to templates and type properties
codepuncher Jul 28, 2020
ad04af1
Cleanup templates
codepuncher Jul 28, 2020
4990ec9
Don't ignore resources directory
codepuncher Jul 28, 2020
a702eb1
Use a View Composer to pass data to views
codepuncher Jul 28, 2020
0e4def9
Rename view namespaces
codepuncher Jul 28, 2020
a76421b
Cast string IDs to int
codepuncher Jul 28, 2020
362fb41
Fix not loading theme namespace
codepuncher Jul 28, 2020
f484236
export-ignore
codepuncher Jul 31, 2020
9cee759
Allow filtering Post ID passed to template
codepuncher Aug 2, 2020
295a86f
array
danlapteacru Nov 18, 2020
7d061fe
remove array #view
danlapteacru Nov 18, 2020
d8bf8f3
loading view from the sage-flbuilder Modules directory
danlapteacru Dec 17, 2020
395ad60
Merge pull request #113 from ItinerisLtd/sage10-load-view-from-sagefl…
danlapteacru Dec 17, 2020
afdb9ca
cr roots/acorn:2.0.0-alpha.0
codepuncher Jul 4, 2021
125c40e
cr 'php:^7.4 || ^8.0'
codepuncher Dec 7, 2022
a916360
cr roots/acorn
codepuncher Dec 7, 2022
2d63750
roots/acorn is a bedrock dependency
codepuncher Dec 7, 2022
bea2d6f
cr php:^8.1 -W
codepuncher Dec 20, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 5 additions & 32 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,10 @@
"license": "proprietary",
"require": {
"php": "^7.1",
"illuminate/support": "^5.4",
"roots/sage-lib": "^9.0"
"roots/acorn": "^1.0.1"
},
"require-dev": {
"automattic/vipwpcs": "dev-master",
"beaver-builder/bb-plugin": "*",
"beaver-builder/bb-theme-builder": "*",
"roave/security-advisories": "dev-master",
"roots/sage": "*",
"wp-coding-standards/wpcs": "^1.0"
},
"config": {
Expand All @@ -21,39 +16,17 @@
"extra": {
"branch-alias": {
"dev-master": "0.11.x-dev"
},
"acorn": {
"providers": "Itineris\\SageFLBuilder\\SageFLBuilderServiceProvider"
codepuncher marked this conversation as resolved.
Show resolved Hide resolved
}
},
"autoload": {
"psr-4": {
"Itineris\\SageFLBuilder\\": "src/"
}
},
"repositories": [
{
"type": "package",
"package": {
"name": "beaver-builder/bb-plugin",
"type": "wordpress-plugin",
"version": "999.999.999",
"dist": {
"type": "zip",
"url": "https://updates.wpbeaverbuilder.com/?fl-api-method=composer_download&download=bb-plugin-pro.zip&license=78682e62702e6676657261766776407a7667"
}
}
},
{
"type": "package",
"package": {
"name": "beaver-builder/bb-theme-builder",
"type": "wordpress-plugin",
"version": "999.999.999",
"dist": {
"type": "zip",
"url": "https://updates.wpbeaverbuilder.com/?fl-api-method=composer_download&download=bb-theme-builder.zip&license=78682e62702e6676657261766776407a7667"
}
}
}
],
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"check-style": "phpcs --standard=ruleset.xml --colors -p -s",
Expand Down
13 changes: 13 additions & 0 deletions resources/views/fl-builder-archive.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@extends("ItinerisSageFLBuilderViews::layouts.archive")

@section('content')
@php
$ids = FLThemeBuilderLayoutData::get_current_page_content_ids();
if ( 'fl-theme-layout' == get_post_type() && count( $ids ) > 1 ) {
$post_id = FLBuilderModel::get_post_id();
} else {
$post_id = $ids[0];
}
FLBuilder::render_content_by_id($post_id, 'div', apply_filters('fl_theme_builder_content_attrs', []));
@endphp
@endsection
codepuncher marked this conversation as resolved.
Show resolved Hide resolved
13 changes: 13 additions & 0 deletions resources/views/fl-builder-single.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@extends("ItinerisSageFLBuilderViews::layouts.archive")

@section('content')
@php
$ids = FLThemeBuilderLayoutData::get_current_page_content_ids();
if ( 'fl-theme-layout' == get_post_type() && count( $ids ) > 1 ) {
$post_id = FLBuilderModel::get_post_id();
} else {
$post_id = $ids[0];
}
FLBuilder::render_content_by_id($post_id, 'div', apply_filters('fl_theme_builder_content_attrs', []));
@endphp
@endsection
25 changes: 25 additions & 0 deletions resources/views/layouts/archive.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!doctype html>
<html @php language_attributes(); @endphp>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
@php wp_head(); @endphp
</head>

<body @php body_class(); @endphp>
@php
wp_body_open();
do_action('get_header');
@endphp

<div id="app">
@include('layouts.app')
</div>

@php
do_action('get_footer');
wp_footer();
@endphp
</body>
</html>
6 changes: 3 additions & 3 deletions src/AbstractBladeModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Itineris\SageFLBuilder;

use FLBuilderModule;
use function App\sage;
use function Roots\app;

/**
* Add Laravel Blade support.
Expand All @@ -32,8 +32,8 @@ public static function renderFrontendTemplate(string $file, FLBuilderModule $mod
}

/** @var AbstractHelper $helper */
$helper = sage(AbstractHelper::class);
$path = $helper->templatePath($module->dir . 'includes/frontend.blade.php');
$helper = app(AbstractHelper::class);
$path = $module->slug . '/includes/frontend';

echo $helper->template($path, [
'module' => $module,
Expand Down
85 changes: 8 additions & 77 deletions src/AbstractHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Itineris\SageFLBuilder;

use function Roots\view;
use function Roots\asset;

abstract class AbstractHelper
{
/**
Expand All @@ -12,22 +15,11 @@ abstract class AbstractHelper
*
* @return string
*/
public function template($file, $data = []): string
public function template(string $file, array $data = []): string
{
return \App\template($file, $data);
}

/**
* Retrieve path to a compiled blade view
*
* @param $file
* @param array $data
*
* @return string
*/
public function templatePath($file, $data = []): string
{
return \App\template_path($file, $data);
return view()->exists("ItinerisSageFLBuilder::{$file}")
? view("ItinerisSageFLBuilder::{$file}", $data)->render()
: '';
}

/**
Expand All @@ -37,7 +29,7 @@ public function templatePath($file, $data = []): string
*/
public function assetPath($asset): string
{
return \App\asset_path($asset);
return asset($asset)->uri();
}

public function getModuleGroup(): string
Expand All @@ -57,13 +49,6 @@ public function getModuleCategory(): string
return __('Custom Widgets', 'fabric');
}

/**
* @param string|string[] $templates Relative path to possible template files.
*
* @return string Location of the template
*/
abstract public function locateTemplate($templates): string;

/**
* Button Styles usable in the cutup
*
Expand All @@ -76,59 +61,5 @@ abstract public function buttonStyles(): array;
*/
abstract public function breadcrumbs();

/**
* Some times le wild <span class="blue hedgehog"> appears, which is when you need this function, to validate both
* blue and hedgehog because sanitize_html_class doesn't allow spaces.
*
* @param mixed $classes "blue hedgehog goes shopping" or array("blue", "hedgehog", "goes", "shopping").
* @param mixed $fallback Anything you want returned in case of a failure.
*
* @return string
*/
abstract public function sanitizeHtmlClasses($classes, $fallback = null): string;

/**
* @param string $videoUrl
* @param bool $isElement
* @param int $size
* @param string $altText
*
* @return string|null
*/
abstract public function videoThumb($videoUrl, $isElement = false, $size = '0', string $altText = '');

/**
* @param string $videoUrl
* @param string $urlType
*
* @return string
*/
abstract public function formatVideoUrl($videoUrl, $urlType = 'embed'): string;

/**
* Creates a responsive iframe and embeds a video player
* or an embed URL for the video
*
* @param string $videoUrl URL of the video.
* @param boolean $isUrl If true, returns the iframe URL, not the iframe.
* @param int $width The width of the iframe.
* @param int $height The height of the iframe.
*
* @return string|false Video embed URL or HTML for iframe embed
*/
abstract public function videoEmbed($video_url, $width = null, $height = null);

/**
* Builds a navigation menu based on parent post, children and siblings
*/
abstract public function getSecondaryNav();

abstract public function getGravityForms(): array;

/**
* Full path to PostGrid template directory.
*
* @return string
*/
abstract public function getPostGridTemplateDir(): string;
}
114 changes: 0 additions & 114 deletions src/God.php

This file was deleted.

4 changes: 2 additions & 2 deletions src/Modules/Accordion/Accordion.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use FLBuilder;
use Itineris\SageFLBuilder\AbstractHelper;
use Itineris\SageFLBuilder\AbstractModule;
use function App\sage;
use function Roots\app;

/**
* Generic Bootstrap accordion widget
Expand Down Expand Up @@ -87,7 +87,7 @@ public static function register(): void
public function __construct()
{
/** @var AbstractHelper $helper */
$helper = sage(AbstractHelper::class);
$helper = app(AbstractHelper::class);

parent::__construct([
'name' => __('Accordion', 'fabric'),
Expand Down
Loading