Notice: Undefined index: content in onboarding.php on line 43 - php

I'm getting this error and not sure why. Here's my code :
$genesis_sample_shared_content = genesis_get_config( 'onboarding-shared' );
return [
'starter_packs' => [
'black-white' => [
'title' => __( 'Black & White', 'genesis-sample' ),
'description' => __( 'A pack with a homepage designed with black and white images.', 'genesis-sample' ),
'thumbnail' => get_stylesheet_directory_uri() . '/config/import/images/thumbnails/home-black-white.jpg',
'demo_url' => 'https://demo.studiopress.com/genesis-sample/',
'config' => [
'dependencies' => [
'plugins' => $genesis_sample_shared_content['plugins'],
],
'content' => array_merge(
[
'homepage' => [
'post_title' => 'Homepage',
'post_content' => require dirname( __FILE__ ) . '/import/content/home-black-white.php',
'post_type' => 'page',
'post_status' => 'publish',
'comment_status' => 'closed',
'ping_status' => 'closed',
'meta_input' => [
'_genesis_layout' => 'full-width-content',
'_genesis_hide_title' => true,
'_genesis_hide_breadcrumbs' => true,
'_genesis_hide_singular_image' => true,
],
],
],
$genesis_sample_shared_content['content']
),
'navigation_menus' => $genesis_sample_shared_content['navigation_menus'],
'widgets' => $genesis_sample_shared_content['widgets'],
],
],
],
];
I have modified the onboarding-shared.php file and remove the code for the content Maybe this is the problem?
Update : Now the menu items are created on theme setup. Here's the modified code :
return [
'plugins' => [
[
'name' => __( 'Genesis Blocks', 'genesis-sample' ),
'slug' => 'genesis-blocks/genesis-blocks.php',
'public_url' => 'https://wordpress.org/plugins/genesis-blocks/',
],
],
'navigation_menus' => [
'primary' => [
'get-started' => [
'title' => 'Get Started',
],
'testimonials' => [
'title' => 'Testimonials',
],
'contact' => [
'title' => 'Contact Us',
],
],
],
'widgets' => [
'footer-1' => [
[
'type' => 'text',
'args' => [
'title' => 'Design',
'text' => '<p>With an emphasis on typography, white space, and mobile-optimized design, your website will look absolutely breathtaking.</p><p>Learn more about design.</p>',
'filter' => 1,
'visual' => 1,
],
],
],
'footer-2' => [
[
'type' => 'text',
'args' => [
'title' => 'Content',
'text' => '<p>Our team will teach you the art of writing audience-focused content that will help you achieve the success you truly deserve.</p><p>Learn more about content.</p>',
'filter' => 1,
'visual' => 1,
],
],
],
'footer-3' => [
[
'type' => 'text',
'args' => [
'title' => 'Strategy',
'text' => '<p>We help creative entrepreneurs build their digital business by focusing on three key elements of a successful online platform.</p><p>Learn more about strategy.</p>',
'filter' => 1,
'visual' => 1,
],
],
],
],
];
The menu items aren't for pages, they're linked to scroll points on the homepage. Not sure how to code that using the above PHP?

I removed $genesis_sample_shared_content['content'] and it now works except the menu items aren't created on theme setup maybe due to this error
Notice: Trying to get property 'name' of non-object in wp-admin/nav-menus.php on line 1098

Related

Extend an assiociative Array with variable

can someone help me, how I can extend an assiociative array with a variable?
I have a loop (foreach):
foreach($this->getWarehouseListForm() as $wareHouse) {
$wareHouseList[] =
[
"title" => "wareHouse[105]",
"form" => [
"storeId[105]" => [
"type" => "inputText",
"options" => [
"name" => "TSL",
],
],
],
];
}
And I want to extend a object like this:
"sections" => [
[
"title" => 'Schuhe24Assistant.ftpServerTitle',
"description" => 'Schuhe24Assistant.ftpServerDescription',
"form" => [
"ftpServer" => [
'type' => 'text',
'defaultValue' => 'ftp.hisasp2.com',
'options' => [
'name' => 'Schuhe24Assistant.ftpServer',
'required' => true,
]
],
"ftpUser" => [
'type' => 'text',
'defaultValue' => 'username',
'options' => [
'name' => 'Schuhe24Assistant.ftpUser',
'required' => true,
]
],
"ftpPassword" => [
'type' => 'text',
'defaultValue' => 'password',
'options' => [
'name' => 'Schuhe24Assistant.ftpPassword',
#'isPassword' => true,
'required' => true,
],
],
"deleteFiles" => [
'type' => 'toggle',
'defaultValue' => true,
'options' => [
'name' => 'Schuhe24Assistant.deleteFiles',
],
],
],
],
], $wareHouseList
But this code produces nothing (no error output) and the structure check fails in this case. If I remove the variable, the structure check is OK.
Can someone help me out?
Kind regards
Henning
Push your $wareHouseList array into the $sections array in the following ways
$sections['wareHouseList'] = $wareHouseList
It should be working.

How to add a custom field to orders in Shopware 6?

By default you can add custom fields to several entities, however I don’t see the order entity in the list of available entities.
Is it possible to add such a field for order so user can fill it in the checkout process, right before sending the order?
And is it possible to add a field for the order and for each order item individually?
Here is one example on how to add to add custom fields to order entity:
$customFieldSetRepository = $this->container->get('custom_field_set.repository');
$customFieldSetRepository->upsert([
[
'name' => self::FIELD_NAME,
// 'global' => true,
'config' => [
'label' => [
'de-DE' => 'Name',
'en-GB' => 'Name'
]
],
'customFields' => [
[
'name' => 'name',
'type' => CustomFieldTypes::DATETIME,
'config' => [
'type' => 'date',
'dateType' => 'date',
'label' => [
'de-DE' => 'Date',
'en-GB' => 'Date'
]
]
],
[
'name' => 'name',
'label' => "Time",
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'de-DE' => 'name',
'en-GB' => 'name'
]
]
],
[
'name' => 'name',
'label' => "name",
'type' => CustomFieldTypes::INT,
'config' => [
'label' => [
'de-DE' => 'name',
'en-GB' => 'name'
]
]
]
],
'relations' => [[
'entityName' => 'order'
]],
]
], $context);

Yii2 : Flot charts extension labelFormatter usage

I'm trying to utilise the Yii2 Flot extension with more or less success. However, I'm having trouble altering the labels of a pie-chart using a labelFormatter function.
This is the extension I'm using: bburim/flot
Here is the code I have so far, it generates a nice chart, but I cannot alter the labels.
Any help is appreciated.
echo Chart::widget(
[
'data' => [
['label' => 'Series1', 'data' => [1, 12]],
['label' => 'Series2', 'data' => [1, 16]],
['label' => 'Series3', 'data' => [1, 89]],
['label' => 'Series4', 'data' => [1, 44]],
['label' => 'Series5', 'data' => [1, 38]],
],
'options' => [
'series' => [
'pie' => [
'show' => true,
'label' => [
'show' => true,
'treshold' => 0.1,
'radius' => 0.6,
'value' => 'value',
],
],
],
'grid' => [
'hoverable' => true,
],
'legend' => [
'position' => 'nw',
'show' => true,
'font' => [
'size' => 16,
],
'margin' => 10,
'backgroundOpacity' => 0.5,
],
],
'plugins' => [
Plugin::PIE,
],
'htmlOptions' => [
'class' => 'chartdiv',
],
]
);
That is a pretty broad term to say customize, I will assume it means providing custom label text, its pretty simple and straight forward you just need to use the new JsExpression() for the callback function to work correctly
echo Chart::widget(
[
'data' => [
['label' => 'Series1', 'data' => [1, 12]],
['label' => 'Series2', 'data' => [1, 16]],
['label' => 'Series3', 'data' => [1, 89]],
['label' => 'Series4', 'data' => [1, 44]],
['label' => 'Series5', 'data' => [1, 38]],
],
'options' => [
'series' => [
'pie' => [
'show' => true,
'label' => [
'show' => true,
'treshold' => 0.1,
'radius' => 0.6,
'value' => 'value',
],
],
],
'grid' => [
'hoverable' => true,
],
'legend' => [
'labelFormatter' => new JsExpression("function(label, series) {
// series is the series object for the label
return 'Custom Label for '+series.label+'';
}"),
'position' => 'nw',
'show' => true,
'font' => [
'size' => 16,
],
'margin' => 10,
'backgroundOpacity' => 0.5,
],
],
'plugins' => [
Plugin::PIE,
],
'htmlOptions' => [
'class' => 'chartdiv',
],
]
);
On a side note I wont use that repo as the owner seems to be unresponsive since 2015 not a single reply on the issues, you might have to maintain or fix the bugs your self so better fork the repo and use your own customized version

Laravel backpack select_from_array

I am totally confused with select_from_array field in laravel backpack.
in my controller i am using a select_from_array field where in options i call a function,but when i run the code error is displayed. please help me with this.
Error : FatalErrorException in EventController.php line 106: syntax error, unexpected '$this' (T_VARIABLE)
controller.php
public $crud = array(
"model" => "App\Larapen\Models\Event",
"entity_name" => "event",
"entity_name_plural" => "events",
"route" => "admin/event",
"reorder" => true,
"reorder_label" => "name",
"reorder_max_level" => 2,
"details_row" => true,
// *****
// COLUMNS
// *****
"columns" => [
[
'name' => "id",
'label' => "ID"
],
],
"fields" => [
[
'name' => "event_name",
'label' => "Event name",
'type' => "text",
'placeholder' => "Event Name",
],
[
'name' => "event_topic",
'label' => "Event Topic",
'type' => "text",
'placeholder' => "Event Topic",
],
[
'name' => "event_type_id",
'label' => "Event Type",
'model' => "App\Larapen\Models\EventType",
'entity' => "eventType",
'attribute' => "name",
'type' => "select",
],
[
'name' => "about_event",
'label' => "About event",
'type' => "ckeditor",
'placeholder' => "About the Event",
],
[
'name' => "country_code",
'label' => "Country",
'type' => 'select_from_array',
'options' => $this->countries(),
'allows_null' => false,
],
],
);
public function countries()
{
..................
}
Please help me with this , why this happens? how to solve this issue?
Waiting for a response................
You can not use the pseudo-variable $this out of class method.
http://php.net/manual/en/language.oop5.properties.php
The pseudo-variable $this is available inside any class method when that method is called from within an object context. $this is a reference to the calling object
So if you want to set the attribute of crud's with $this, you can set it in the __construct function
public function __construct()
{
$this->crud['fields'][4] = $this->countries();
}
Or initialize it the __construct function
public $crud;
public function __construct()
{
$this->crud = array(
'model' => 'App\Larapen\Models\Event',
'entity_name' => 'event',
'entity_name_plural' => 'events',
'route' => 'admin/event',
'reorder' => true,
'reorder_label' => 'name',
'reorder_max_level' => 2,
'details_row' => true,
// *****
// COLUMNS
// *****
'columns' => [
[
'name' => 'id',
'label' => 'ID'
],
],
'fields' => [
[
'name' => 'event_name',
'label' => 'Event name',
'type' => 'text',
'placeholder' => 'Event Name',
],
[
'name' => 'event_topic',
'label' => 'Event Topic',
'type' => 'text',
'placeholder' => 'Event Topic',
],
[
'name' => 'event_type_id',
'label' => 'Event Type',
'model' => 'App\Larapen\Models\EventType',
'entity' => 'eventType',
'attribute' => 'name',
'type' => 'select',
],
[
'name' => 'about_event',
'label' => 'About event',
'type' => 'ckeditor',
'placeholder' => 'About the Event',
],
[
'name' => 'country_code',
'label' => 'Country',
'type' => 'select_from_array',
'options' => $this->countries(),
'allows_null' => false,
],
],
);
}

Yii2 Editable Widget custom attribute

i am working with Yii2 and using Editable Widget
My code is below
Editable::widget([
'id' => 1,
'name' => 'assignTo',
'value' => 1,
'url' => 'url here',
'type' => 'select',
'mode' => 'inline',
'clientOptions' => [
'toggle' => 'dblclick',
'emptytext' => 'Unassigned',
'placement' => 'right',
'select2' => [
'width' => '124px'
],
'source' => 1,
'value' => 1,
],
]);
i want to add custom attribute on that generated html tag. i have tried as below but its throw error
Editable::widget([
'id' => 'assignTo_'.$todo->id,
'name' => 'assignTo',
'redirect_url' => 'custom_attriute', // this is custom attribute that i need
'class' => 'my own custom class', // this is custom attribute that i need
'value' => 1,
'url' => 'url here',
'type' => 'select',
'mode' => 'inline',
'clientOptions' => [
'toggle' => 'dblclick',
'emptytext' => 'Unassigned',
'placement' => 'right',
'select2' => [
'width' => '124px'
],
'source' => 1,
'value' => 1,
],
]);
and also i want to add my own class in the generated html i have tried same as above but its not working.
is there any way to make it possible what i want?
dosamigos\editable\Editable extends yii\widgets\InputWidget which has an $options variable that holds:
The HTML attributes for the input tag.
Editable::widget([
'id' => 'assignTo_'.$todo->id,
'name' => 'assignTo',
'options' => [
'redirect_url' => 'custom_attriute', // this is custom attribute that i need
'class' => 'my own custom class', // this is custom attribute that i need
],
'value' => 1,
'url' => 'url here',
'type' => 'select',
'mode' => 'inline',
'clientOptions' => [
'toggle' => 'dblclick',
'emptytext' => 'Unassigned',
'placement' => 'right',
'select2' => [
'width' => '124px'
],
'source' => 1,
'value' => 1,
],
]);

Categories