Solution:
Change {} braces to ()
Change your code from
{programsData.map((program) => {
<div className=”category”>
{program.image}
</div>
})}
To
{programsData.map((program) => (
<div className=”category”>
{program.image}
</div>
))}
codeinitiator
Solution:
Change {} braces to ()
Change your code from
{programsData.map((program) => {
<div className=”category”>
{program.image}
</div>
})}
To
{programsData.map((program) => (
<div className=”category”>
{program.image}
</div>
))}
If you face below error in your Magento 2 custom module.
Not registered handle [namespace]_[module]_team_index_data_source
There is one reason for above error is that you are missing di.xml file from [namespace]_[module]/etc/ folder
Copy the following code into di.xml file and place it in root of the etc folder of your module. Don’t forget to change the namespace and module name according to your module in the code.
<type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
<arguments>
<argument name="collections" xsi:type="array">
...
<item name="[namespace]_[module]_team_index_data_source" xsi:type="string">[Namespace]\[Module]\Model\ResourceModel\Team\Collection</item>
...
</argument>
</arguments>
</type>
DB schema command would not run again if it has been already executed so you need to remove database entry for your module in setup_module table.
Removing the record from setup_module
with module = ‘MyVendor_Helpdesk’ should make it run again.
Keeping writing the good code 🙂
Two things keep in mind
1) Form action could be defined as
<?php echo
$this->getUrl("pilot_smile/options/save"); ?>;
2) Do not forget to add form_key else you would be going to waste your several hours on finding the dashboard redirection issue on form submission.
<input name="form_key"
type="hidden"
value="<?php echo $block->getFormKey()?>"
/>;
If you face “Argument 1 passed to App\Service\FileUploader::upload() must be an instance of Symfony\Component\HttpFoundation\File\UploadedFile, string given, ” this error while playing with files in Symfony 4. Then you need to change your file field in controller as. Change your code from
$file
= $task->getTaskLogo();
$file= $form['task_logo']->getData();
Where task_logo is the name of the file field of your form.
If you face this error on your local then you need to change your DB configuration to run the project on local with docker. Your docker config file might look like this In the above settings (db:) this is your localhost so your database configuration will look like database host: DB database username: rootdatabase password : 12345
update DB command
//deploy static content
// change permissions
//deply setup content
//enable/disable module
<div
class
=
"social-share-btn"
>
<div id=
"fb-root"
></div>
<script>(
function
(d, s, id) {
var
js, fjs = d.getElementsByTagName(s)[0];
if
(d.getElementById(id))
return
;
js = d.createElement(s); js.id = id;
js.src =
"//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0"
;
fjs.parentNode.insertBefore(js, fjs);
}(document,
'script'
,
'facebook-jssdk'
));</script>
<div
class
=
"fb-share-button"
data-href=
"<?php echo "
http:
//".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];?>" data-layout="button_count"></div>
<a href=
"<?php echo "
http:
//".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];?>" data-count="horizontal" class="twitter-share-button">Tweet</a>
<script>!
function
(d,s,id){
var
js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?
'http'
:
'https'
;
if
(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+
'://platform.twitter.com/widgets.js'
;fjs.parentNode.insertBefore(js,fjs);}}(document,
'script'
,
'twitter-wjs'
);</script>
<!-- Place this tag in your head
or
just before your close body tag. -->
<script src=
"https://apis.google.com/js/platform.js"
async defer></script>
<!-- Place this tag where you want the share button to render. -->
<div
class
=
"g-plus"
data-action=
"share"
data-annotation=
"bubble"
data-href=
"<?php echo "
http:
//".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];?>"></div>
<script src=
"//platform.linkedin.com/in.js"
type=
"text/javascript"
>
lang: en_US
</script>
<script type=
"IN/Share"
data-counter=
"right"
data-url=
"<?php echo "
http:
//".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];?>"></script>
</div>
<div
class
=
"social-share-btn"
>
<div id=
"fb-root"
></div>
<script>(
function
(d, s, id) {
var
js, fjs = d.getElementsByTagName(s)[0];
if
(d.getElementById(id))
return
;
js = d.createElement(s); js.id = id;
js.src =
"//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0"
;
fjs.parentNode.insertBefore(js, fjs);
}(document,
'script'
,
'facebook-jssdk'
));</script>
<div
class
=
"fb-share-button"
data-href=
"<?php echo "
http:
//".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];?>" data-layout="button_count"></div>
<a href=
"<?php echo "
http:
//".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];?>" data-count="horizontal" class="twitter-share-button">Tweet</a>
<script>!
function
(d,s,id){
var
js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?
'http'
:
'https'
;
if
(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+
'://platform.twitter.com/widgets.js'
;fjs.parentNode.insertBefore(js,fjs);}}(document,
'script'
,
'twitter-wjs'
);</script>
<!-- Place this tag in your head
or
just before your close body tag. -->
<script src=
"https://apis.google.com/js/platform.js"
async defer></script>
<!-- Place this tag where you want the share button to render. -->
<div
class
=
"g-plus"
data-action=
"share"
data-annotation=
"bubble"
data-href=
"<?php echo "
http:
//".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];?>"></div>
<script src=
"//platform.linkedin.com/in.js"
type=
"text/javascript"
>
lang: en_US
</script>
<script type=
"IN/Share"
data-counter=
"right"
data-url=
"<?php echo "
http:
//".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];?>"></script>
</div>
create virtual host
Localhost name will be : api.local.btv
file's path : /var/www/html/projectfolder/api/web
Step 1 :
create conf file with below command
sudo nano /etc/apache2/sites-available/api.local.btv.conf
Step 2 : paste below code and save and exit
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/projectfolder/api/web
ServerAdmin admin@example.com
ServerName api.local.btv
ServerAlias api.local.btv
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
Step 3 : sudo a2ensite api.local.btv.conf
Step 4 : sudo service apache2 restart.
Step 5: Enter one entry into /etc/hosts file as below
127.0.0.1 api.local.btv
And it’s done. TADA.
Now you can access your website in the browser by hitting this URL http://api.local.btv