texts: Check if the page is the front page in a template

texts:
How do I make a simple front page check wich only shows a  in my template when the user is on the front page of the drupal website?

I tried this but it ended up crashing:

<?php function drupal_is_front_page() {?>
TEST
 <?php } ?>

Is this possible with a if instead of this function wich i found on the drupal website?

Thanks!


texts: How can I understand when a node is being edited or viewed?

texts:
I want to add a class to the body to distinguish the node's view page from the edit page.

In classy you have 'page-node-type-' ~ node_type|clean_class. I'd like to add page-node-type-' ~ node_type|clean_class ~ '-edit' if we're on the edit page, but I can't figure out what that if statement would have in its condition.

Which code should I use to add that class only when a node is being edited?


texts: PathProcessorEntityResourceBC Class not found error after updating to Drupal 8.4

texts:
After updating to Drupal 8.4 I now have an error in my browser when trying to load my Drupal site:

Error: Class '\Drupal\rest\PathProcessor\PathProcessorEntityResourceBC' not found in Drupal\Component\DependencyInjection\Container->createService() (line 262 of core/lib/Drupal/Component/DependencyInjection/Container.php)

If I execute a drush or drupal console command the error is the same but with more of a stacktrace.

I upgraded to Drush 9 which simplifies the error a bit more:

Service 'rest.path_processor_entity_resource_bc' for consumer 'path_processor_manager' does not implement Drupal\Core\PathProcessor\InboundPathProcessorInterface.

It looks like I have some dependency missing somewhere. I'm not sure how to track it down.

I have tried "composer install", "composer update", and removing the vendor directory and re-installing the composer packages but nothing has worked yet.

Has anyone had this error or know how to get the missing PathProcessorEntityResourceBC class?


texts:
node_load($nid);
$node->mytaxonomyfield['und'][0]['tid']=$data;
node_save($nid)

my corresponding terms : online,offline,pre-online  and the corresponding tid : 1,2,3

my question : what the program will be that changing the field data by words instead of tid


texts: Can we pass argument to a form from a Twig template

texts:
I have a form that accepts a custom argument sourceid

 public function buildForm(array $form, FormStateInterface $form_state, $sourceid = NULL)

Now, this form is displayed in a twig template multiple times using a for loop.
For each instance of this form the sourceid is different in the twig template.
The value of the sourceid is present in the twig template. Can I pass it to the form from the twig template itself? Or should I modify my controller and render the form in the template along with the id?

Code in the twig template displaying the form is as follows:

{% for item in field %}
    {% if item.content %}
      <p> {{ item.content|raw }} </p>
      <p> {{ item.sourceid|raw }} </p>
      <div>{{ metadata_form }}</div>
    {% endif %}
(% endfor %}

The variable metadata_form has the form element in it.


texts: will be any problem with my website if I empty all the cache tables from Database?

texts:
I'm trying to move my website from localhost to a server. the size of DB is too big and from what I saw the cache tables have big size. is there any problem (for my localhost version of site) if I empty all of them? (specially cache_form)

besides that when I was trying to import the DB into server the server reported an error when it was inserting cache_views table; it is very important for me to empty this table to avoid insertion error in the future.

thanks


texts: remove node options from admin area when creating nodes

texts:
where creating nodes (node/add/content-type) bellow body box there are some options related to comments, author, menu and ..

How can I hide those options?


texts: I would like to display the body summary of a single, specific article in the header of a view using the "entity: rendered entity" option and selecting "content." I can display the full content of the article and the teaser, but I don't see a way to access the article's fields individually. I don't want to display the title / author information. (My (probably wrong) guess is the "tokens" option, but upon selecting it, I see no place to utilize the tokens.) Insight appreciated. Thanks!


texts: Is it acceptable solution to set session.gc_maxlifetime in hook_init()?

texts:
We need to set session.gc_maxlifetime separately on the site and mobile (app).
Is any best practices here?

UPD. My final solution looks as follows:

$args = arg();
$is_mob_rest_api = FALSE;
if (!empty($args)) {
  $is_mob_rest_api = $args[0] == 'api' && $args[1] == 'v1';
}
$session__gc_maxlifetime = $is_mob_rest_api ? 31536000 : 1440;
ini_set('session.gc_maxlifetime', $session__gc_maxlifetime);


texts: How to structure theme folder to make it more manageable?

texts:
So far, I've been able to put page, node, field and block templates in their own separate folders. My idea is that Drupal needs to find the main original tpl file (ie page.tpl.php) in a folder and will then look for the overriding files in that directory. If so, how do I structure a similar thing for my Views templates? Do I create a few folders and put the original files (view-fields.tpl.php etc) in each respective folder?

I'll try my own suggestion and will post back if it works, so that others can benefit from it.


texts: I'm fairly new to drupal and the omega theme, but I've gotten it to work on a couple virtual, test sites.  Unfortunately, now that I'm attempting to get it to work on a live site, it is stuck in mobile mode.  I can't get it to switch to any other, normal mode.  The "resize me" option is missing.  It still functions properly, but I don't exactly want users on a computer to see the mobile version of the website.  Any ideas?


texts: Add to cart button not displaying inside custom text in drupal 8 views

texts:
I created a  product display view in drupal8 to display the product.
For this, I added some fields like product price, title, and " add to cart" form.
When I call all the fields inside custom text fields, the add to cart button is not displaying on the page.  To display the " add to cart" button, I am using

{{ variations_target_id }}

from replacement patterns.


texts: Multiple (bulk) upload with the media browser widget

texts:
I'm using Media 7.x-2.0, and I would like to be able to upload more than one image/media at the same time with the media browser widget. How can I do this?

I know about Plupload but I just need HTML5 support and don't want a special widget.

There is also Multiupload Filefield Widget, but I want to keep the media browser widget.


texts: How to implement an enumerated field using hook_schema()?

texts:
I need to have a field in my database that is shall hold a limited set of enumerated values.

The MySQL ENUM type is not one of the predefined Drupal data types.

So how do one implement a field to hold enumerated values using hook_schema?

I understand that I can do it with a tiny int, but how do I map from and to the strings of enumerated values (e.g. "zero", "one", "two", "three") to integers stored in the DB?


texts:
EDIT4: As it turns out, the view was using exposed filters, which causes the view to return html for a form.  HTML isn't allowed to have multiple forms, so the browser might remove the second one, confusingly.  The only solution I could imagine was putting the view somewhere else, or putting it inside of an iframe.

I'm putting an embedded view into an existing form with hook_form_alter, and when I do this, it's causing the Add another item button for one of the form's elements to stop working.  It sends an ajax request and gets a 500 response.  Here's how I'm doing it:

$the_view = \Drupal::service('renderer')->render(views_embed_view('images', 'page_1'));
$form['newthing'] = array(
  '#type' => 'markup',
  '#markup' => $the_view,
);

The interesting thing is, it's not actually the second part that causes it, it's just the render() line that causes the problem.  The rendered view data doesn't actually have to be inserted into the form.

I've tried it with different views, and I legitimately can't figure out the reason why some views break my form's ajax and some don't.  It doesn't seem to be exposed filters, or having "Use ajax" enabled, or having a pager.

Whatever it is, it seems to cause the Form Data to not be sent, when clicking the "Add another item" button.  This information, which would normally be sent on the ajax request:

name[0][value]:
    form_build_id:form-eX_LK4K7R4X0csFlHfJGIZ7auabXu7kVIa1cctPA1iE
    form_token:1tBuaaaRRJ6RHJdTtHwGWpo3gieX4ukYsfkf1QFdeyw
    form_id:my_form
    user_id[0][target_id]:admin (1)
    field_story_reference[0][target_id]:
    field_story_reference[0][_weight]:0

...is missing.

EDIT: I guess I never really phrased it in the form of a question.  How do I get it to not break my Add another item button?  Should this be reported, or is there a known workaround?

EDIT 2: Thank you 4k4, but now something even stranger is happening, now that I'm not doing the render part. When I click the Add another story button, it now disappears and prints the message "An unrecoverable error occurred. The uploaded file likely exceeded the maximum file size (2 MB) that this server supports. But, obviously I'm not uploading any file. The ajax request is still not sending the form data that was missing when I did it the other way.

EDIT 3: I can see that after I've embedded my view, there is a  tag, which would normally have been at the end of the form, after the save button.  It hasn't been moved, it's just that there's an extra one.  When I embed the view, there are two forms, one inside of the other.  It looks like Chrome's Inspector had removed the second  tag automatically from the html, but left the extra closing  tag.  I can see it when I go to view page source, though.


texts:
I want to use the Views data export module and some exposed filter to export my data as csv. I followed the steps and comments mentioned in this link:
Does the Data Export module support exposed filters?
and I put the same exposed filters and same fields in the export display as well as in the page display. They have now the exact same configuration and I chose the BASIC exposed form style for both and I have added a reinitialization button for both of them as well and everything works good.
When I go to the page's path  and apply a filter, and press download as CSV, the CSV file contains the filtered data (which is good). Now , if  I then press reinitialize on the page display, all results reappear (which is what I want), but if I click download as csv, the data that is exported is the previously  filtered one not all the results, this is happening despite having all the results appearing on the page display!!
I tried to remove the Remember previous selection from both of the displays but it didn't change anything. Seems that exposed filters of the export display are working just like those on the page however there must be a problem regarding the reinitialization button. If clicked on the page, it is not applied on the export.


texts: Is it necessary to cache external api requests?

texts:
I am working on a custom module to pull tweets.  Is it necessary for me to cache my request to Twitter's API, if I have both Drupal 8's Internal Page Cache and Dynamic Page Cache enabled?  Can I just rely on the Page Cache?

For instance, if I set some data to cache for every 3 minutes, but the page cache is set for every 5 minutes, my custom data cache time will be ignored, and my data will be cached every five minutes, correct?

For reference, I meant to set my custom cache like so:

$cid = 'my_custom_module_id';
if ($cache = \Drupal::cache()->get($cid)) {
  $mydata = $cache->data;
} else {
  $mydata = [DO MY API CALL STUFF!]
  \Drupal::cache()->set($cid, $mydata, 180);
}


texts:
I am testing with the SShop theme. The sliders I have added are not shown properly.

All the pictures have the same format: 1600x800.
Home >> Administration >> Reports >> Recent log messages does not give any error messages.
In the [drupalrootfolder]/libraries folder the following is shown:

bootstrap
colorbox
fontaweson
jquery.cycle
jquery.hoverIntent
jquery.pause
json2
smartmenus
stacktable.js

I also installed the SShop demo theme. A crosscheck did not reveal any big differences.
Any help is appreciated.


texts:
I want to do this: If I enter a body in content type, on save the content type body searched and  automatically link to exists node title.

As example :
body:   The drupal is one of best CMS systems,

If I have a node with title "drupal" I want  the drupal link to it automatically on save,
is there any module to do this? If not appreciate any idea help me to implement it.

I found Alinks module, it similar to what I want but It not link to existing nodes, it just link to some user defined word and links.

The main problem is searching for existing node title not linking to them,
we have body with many word,I want if a word equal node title that exist , it link to it


texts: Setting node ID sequence to a particular higher value for future created records

texts:
We have an organic groups based portal in D7 where many blood banks add records. We recently initiated Drupal 8 migration and are close to completion. However, we would want to add selective blood banks first to the new D8 portal, have it tested before we ask all the other blood banks to use the new portal.
Is it possible to set a higher NID value when new records are created by new users? Migration data for remaining customers can happen seamlessly as their NID values will be lower.
Thanks.


texts: Creating custom bread crumb trails (Drupal 7)

texts:
How would one create a custom breadcrumb such as this:

For a given page such as a node or organic group page in Drupal 7?


texts: Programatically initialising paragraph field in drupal 8

texts:
I would like to programatically populate a paragraph field with a default value for one of my content types.

I came up with the following solution:

use \Drupal\Node\NodeInterface;
use \Drupal\paragraphs\Entity\Paragraph;

function my_site_node_create(NodeInterface $node) {
    switch ($node->getType()){
        case 'my_content_type':
            $paragraph = Paragraph::create([
                'type' => 'references',  // paragraph type machine name
                'field_references_title' => [  // paragraph's field machine name
                    'value' => 'Some examples of what we have done' // body field value
                ],
            ]);
            $paragraph->save();

            $node->set('field_paragraphs_content', [
                [
                    'target_id' => $paragraph->id(),
                    'target_revision_id' => $paragraph->getRevisionId(),
                ],
            ]);
            break;
    }

}

This code seems to work but im worried I might be creating useless Paragraph-entities when the user doesn't save this node (because of the '$paragraph->save()').

How can I avoid this?


texts: Change routing behaviour for non-existent entities

texts:
For my custom entity type called item, I would like to set up routes such that the path:

/item/{item}

views the entity as normal, if it exists
if it doesn't exists, redirects to the create form

The default Entity controllers create a 404 response. How can I change that behaviour?

Currently, the routes are generated through the entity's annotation (via DefaultHtmlRouteProvider):

* links = {
*   "canonical" = "/item/{item}"
*   ...
* }


texts: Can I allow a user to add additional tabs in quicktabs?

texts: In the same way that we can set a field to unlimited, allowing a user to add more than one value, might there be a way to do the same using quicktabs?


texts: How to set field values when creating new node with Rules?

texts:
We can create new nodes using Rules Actions. However, when creating new nodes, if we want to set the fields' values for the new node, there seems to be no way to do that in Rules.

E.g. I want to create a new node, using Rules Action, which has a field field_age. And I want to set it to some value depending upon the event. How do I do this?

Can this be done using Rules?


texts: Connecting views to another Drupal database

texts:
I have a need to display views using an old Drupal database.  These views are already created, so I exported them and dropped the export code into a custom module hook_views_default_view, put in the necessary return, changed the view name, updated the paths, etc.  So, now I have two Views showing exactly the same dataset.

I need the newly created one to query against an old database; both databases have exactly the same structure. I have the old database setup in settings.php and, I thought, all I needed to do was add $view->database = "oldlife". That's not working - I'm getting the exact same data in both views (two different paths).

This is the code, minus all the handlers and unnecessary stuff:

function lwg_old_db_views_api() {
    return array(
            'api' => 3,
            'path' => drupal_get_path('module', 'lwg_old_db'),
    );
}

function lwg_old_db_views_default_views() {
    $view = new view();
    $view->name = 'commerce_vbo_views_orders_oldlife';
    $view->description = 'Display a list of orders for the store admin.';
    $view->tag = 'commerce';
    $view->database = 'oldlife';
    $view->base_table = 'commerce_order';
    $view->human_name = 'Orders';
    $view->core = 0;
    $view->api_version = '3.0';
    $view->disabled = FALSE;
    /**
      * many lines of $handler-> stuff
      */
    $handler = $view->new_display('page', 'Page', 'page_1');
   $handler->display->display_options['path'] = 'list-all-nodes';
   $views[$view->name] = $view;
   return $views;
}


texts:
I want to be able to upload WAV files and input tags such as artist, title, isrc etc. and covert to tagged 320 knit mp3, flac an alac files. There's some drupal 6 modules that do some of this but not for d7 as far as I can see. Can anyone point me in the right direction?

The D6 audio module could read & write ID3 tags and the audioconverter module can convert to Mp3 - while these doesn't fully do what I need it does hint at that it's possible to do this via drupal. Correct?

From what I've understood FFMPEG/SoX/LAME are all ways to handle tasks like this.

I've never written a module myself but wouldn't mind putting in the hard work of learning to do so if anyone can assist with guidance.


texts: Where to define permissions for user roles in FCKEDitor file uploads?

texts:
There is this page where you upload files with FCKeditor
My admin user can do that , but I want the same for the Editor role
(I already defined a profile for it)
It´s a matter of permissions and I´ve enabled all on the FCKEditor but I´m sure it´s something else...that I have to enable...


texts: run drupal console command from linux cron

texts:
I have created a .sh file which runs a drupal console command via bash.
I have tried to run this script in linux cron and all other commands work with exception to the drupal console command.

How can I get the drupal console command to work using cron?

Error output:

/var/www/html/***/removeusers.sh: line 79: drupal: command not found

crontab:

16 16 * * * bash /var/www/html/****/removeusers.sh --db_user=**** --db_password=**** --db_name=**** --db_host=localhost  >> /var/log/removeusers.log 2>&1

removeusers.sh:

 #!/bi/bash -x
PATH=/bin:/sbin:/usr/bin:/usr/sbin
/bin/sh /etc/profile

#removeusers.sh

# Help menu
print_help() {
cat <<-HELP
This script is used to remove users of a Drupal database
you need to provide the following arguments:

  1) Database username.
  2) Database password.
  3) Database name.
  4) Database host.

Example: (sudo) bash ${0##*/} --db_user=USER --db_password=PASSWORD --db_name=DBNAME --db_host=HOST
HELP
exit 0
}

while [ "$#" -gt 0 ]; do
  case "$1" in
    --db_user=*)
        db_user="${1#*=}"
        ;;
    --db_password=*)
        db_password="${1#*=}"
        ;;
    --db_name=*)
        db_name="${1#*=}"
        ;;
    --db_host=*)
        db_host="${1#*=}"
        ;;
    --help) print_help;;
    *)
      printf "***********************************************************\n"
      printf "* Error: Invalid argument, run --help for valid arguments. *\n"
      printf "***********************************************************\n"
      exit 1
  esac
  shift
done

if [ -z "${db_user}" ] || [ -z "${db_password}" ] || [ -z "${db_name}" ] || [ -z "${db_host}" ]; then
  printf "*********************************************\n"
  printf "* Error: Please provide valid access. *\n"
  printf "*********************************************\n"
  print_help
  exit 1
fi

uidList=($(mysql -u ${db_user} -p${db_password} ${db_name} -h ${db_host} -N -B -e "select uid from authmap;"))

# return array instance
# echo ${uidList[$i]}
# return array length
# echo ${#uidList[@]}

# split array into groups of 10 and

for (( i=0; i<=${#uidList[@]}; i++))
    do
        echo ${#uidList[@]} "entries available to delete"
        counter=0
        batch=10
        while [ $counter -le $batch ]
        do
            echo "Attempting to delete user id" ${uidList[$i]}
            if drupal user:delete --user-id="${uidList[$i]}"; then
                echo $counter 'of' $batch 'in group before server rest'
            else
                printf 'delete failed\n'
                break
            fi
            ((counter++))
            ((i++))
        done
        echo All done
        sleep 10
        if [ ${#uidList[@]} -lt 0 ]; then
            break
        fi
    done


texts: In Drupal 8 how can I print the page title within a paragraph.html.twig

texts:
Is there a way to print the page title within a paragraph.html.twig?

In Drupal 7 your could just do a drupal_get_title(); in an tpl.php and use it as a variable.

That function is depreciated and from what I read about TWIG not in the spirit of themeing in Drupal 8 now.

What is the Drupal 8 way to do this?


texts: Automatic cron job not giving proper results

texts:
When I ran my cron manually ,everything is working fine.But when it run automatically it is generating the error message.

This is my code in my cron.

function hook_cron() {
  mymodule_report();
}

function mymodule_report() {
  $user = variable_get("Username",NULL);
  $password = variable_get("Password",NULL);

  if(strlen($user) >0 && strlen($password) > 0) {
    my_function();
  }
  else {
    watchdog(watchdog_id, 'Not running my cron as not all credentials have  been specified', NULL, $severity = WATCHDOG_WARNING);
    return;
  }

}

In my settings.php

$conf['Username'] = "my name"
$conf['Password'] = "my password"

Well if I run cron manually,it takes the username and password variables and executes my_function.

But when cron run automatically ,username and password will take NULL values and generating the warning from watchdog    "Not running my cron as not all credentials have been specified"

Is it not taking global variables when running automatically,i am totally confused on this
Please help


texts: Xdebug: What Drupal values for "Project URL" & "Index File" will NetBeans accept for a new Configuration?

texts:
I just slept at a Holiday Inn last night and watched this Vimeo Tut on Xdebug. I'm experiencing trouble with a Views plugin and wish to "step into the Matrix" to find where the error is occurring.

In NetBeans each project is set up with a default URL and template file. These are set from File >> Project Properties -- Configuration (New). I have Netbeans and Xdebug working. The project default is the site home url and the top [drupal_root/] index.php file. I'm guessing if I make a new configuration of "Project URL" and "Index File" then Netbeans will open the project and focus my debug session to this area of Drupal. But so far the urls and index pages I'm selecting--Netbeans doesn't like.

I want to debug between the Edit View Page URL and the Configure Item URL. The error occurs between these two pages,

http://mysite.local/admin/structure/views/view/drag_test

And when I click on Draggableviews: Weight (asc) (under Sort criteria), the resulting non-JavaScript "configure item" page [*] displays the errors at the top,

http://mysite.local/admin/structure/views/nojs/config-item/drag_test/page/sort/weight

I'm guessing the views template, views-ui-edit-item.tpl, is what I want. Netbeans of course wants an index file, but in Drupal that's the top page.

What Drupal values for "Project URL" & "Index File" will NetBeans accept for a new Configuration?

[*] FYI. In case you're not immediately familiar with what a non-JavaScript Edit View Page is, remember how it was in Drupal 6 with options at the bottom of the page? Only in D7 options display on a new page when JavaScript overlay is off. (^_^)


texts: Help with LDAP module for user authentication in Drupal 8.3.7

texts:
I just installed Drupal 8.3.7 via composer and am trying to get user logins to work against our LDAP server. I added and enabled the following modules:

We are using ldaps on port 636 rather than START-TLS on port 389 so I configured the LDAP settings as follows:

[SERVER section]
  Name: <whatever>
  Machine-readable name: ldap (not the hostname of our LDAP Server)
  LDAP Server Type: Default LDAP
  Server address: ldaps://<ip address of ldap server>
  Server port: 636

[BINDING section]
  Binding method for searches:L Service Account Bind: Use credentials in the Service Account field below to bind to LDAP
  DN for non-anonymous search: <dn for ldap auth user>
  Password for non-anonymous search: <password for ldap auth user>

[USERS section]
  <base dn for users>
  AuthName attribute: cn

When I try to test this config, I enter my cn in the "Testing Drupal Username" field and then click the Test button. I receive the following errors:

  Failed to bind with service account. LDAP error: Can't contact LDAP server (-1)
  Failed to find test user <my cn> by searching on cn = <my cn>.'

I can perform an ldapsearch using the auth ldap bind DN ok on the Drupal server. I enabled logging but the messages sent to /var/log/localmessages are not useful. I just see things like:

  ldap_search() function error. LDAP Error: Can't contact LDAP server (-1), ldap_search() parameters:
  LDAP search error: Can't contact LDAP server (-1). Context is base DN: <base dn> | filter: (cn=<my cn>)| attributes: []

Anyone have any ideas? I looked at the tcpcdump output comparing ldapsearch and the Drupal LDAP test and I don't see any TLS handshakes in the Drupal test case so I'm not convinced I have the ldaps part of the configuration working correctly.


texts: How do I add custom content fields to content types in Open Social?

texts:
I am trying to add fields to my new custom content type in Open Social (OS), the Drupal social networking distribution. I follow the regular procedure of adding a new custom content type from /admin/structure/types/add.  OS will add the custom content type fine, but then after the new content type is created, the list of content types at /admin/structure/types shows only Edit or Delete operations in the combo box for the operations, with Edit being the default. Normally, there are possible operations of Manage fields, Manage form display, and Manage display as well in the combo box for the operations. Furthermore, when I use the normal path for adding a custom field for the content type, namely /admin/structure/types/manage/<content type>/fields where <content type> is the content type I just created, I get an error message of The requested page could not be found. OS exhibits the same behavior for existing content types like Topic. I have found this to be the case for version 8.7.8 and 8.8.10 of OS.
Does anyone know how to enable to ability to add and manage custom fields for new content types in Open Social?


texts:
I am trying to authenticate users as below. I don't get any error, but it doesn't log in users.
autoLogin.php is located in the root folder. Visiting http://example.com/drupal8/autoLogin.php shows me the Login required page every time.
use Drupal\Core\DrupalKernel;
use Symfony\Component\HttpFoundation\Request;

$autoloader = require_once 'autoload.php';

$kernel = new DrupalKernel('prod', $autoloader);

$request = Request::createFromGlobals();
$response = $kernel->handle($request);

$uid = 1;
$user = Drupal\user\Entity\User::load(1);
$kernel->prepareLegacyRequest($request);
user_login_finalize($user);
$response->send();
$kernel->terminate($request, $response);


texts:
I have a HOOK_views_data() hook and everything in it works except my timestamp field.  It's pretty much stolen from webform.

Except views always complains about a broken/missing handler for this field (just this one - 'views_handler_field_date').

// Submitted timestamp.
$data['nodelog_report_submission']['submitted'] = array(
  'title' => t('Submitted'),
  'help' => t('The date this submission was submitted.'),
  'field' => array(
    'handler' => 'views_handler_field_date',
    'click sortable' => TRUE,
  ),
  'filter' => array(
    'title' => t('Submitted'),
    'handler' => 'views_handler_filter_date',
  ),
  'sort' => array(
    'handler' => 'views_handler_sort_date',
  ),
  'argument' => array(
    'handler' => 'views_handler_argument_date',
  ),
);

I'm pulling my hair out with this one.  Anyone out there that can save me from baldness?


texts: Whenever new user registered, how to make them active based on some condition automatically

texts: I have a cloud driven drupal site. In the site one content type exists named as people it has email field. The content in this content type is around 5000. Whenever new user registered I want to check user email with the people content type email field that is around 5000 content i want to check. If user email matches with any one email in people content type I want to make them active automatically. How to do this.? Can anyone give me suggestions. I tried with rules but its not happening. Can anyone suggest some custom php code for rules module


texts:
I was looking into MongoDB module, but found it very verbose and overly complicated to perform simple DB operations and this module seems to be tightly integrated with Drupal entities.

Is there any other Drupal-PDO wrapper for Mongodb that is easy, secure (NO SQL injection free) for simple DB operations in Drupal?

Thanks for your time.


texts: How do i use a renderable array to create a list with children render arrays

texts:
I have a function which returns a facebook wall feed. The data comes back fine but the point i'm having an issue with is combining the list children with the list array.

I start out by defining the list without children.

   $row = array(
    'item_list' => array(
      '#theme' => 'item_list',
      '#attributes' => array(
        'class' => array('wall-post-list')
      ),
    )
  );

After that i jump in to a foreach loop which i'll omit for clarity since it's large.
First i create a container which will be inside the li of the list and then stuff that container with children like i did with 'account_link' which will be rendered as #markup FAPI elements.

     $list_items[$interation]['data'] = array(
      '#theme' => 'container',
      '#attributes' => array(
        'id' => array($post['id']),
        'class' => array('wall-post-content', $post['type']),
      ),
      'account_link' => array(
        '#markup' => l('','http://facebook.com/' . $post['from']['id'], array(
          'attributes' => array(
            'class' => array('picture'),
            'target' => '_blank',
          ),
          'html' => TRUE,
        ))
      ),
    );

So after building up what this list item is going to have in it I take the $list_items and stuff them into $row['#items']. And now this is where my issue is. The array looks perfect almost to perfect... And when it renders to the page i get

Array

Is there some issue with my approach? or does theme_item_list not render out the children of a li and if so how can I get this to render recursively through the whole array?

Full function code here http://pastebin.com/dr3b4CTX

Correction: seems i was using #theme rather than #type in this situation.


texts: How to use an aliased content title for a Views contextual filter?

texts:
I've set up a page view with a path of 'services/communication/%' the '%' being a contextual filter of 'Content: Title'.

The problem with this is that the url ends up looking something like 'services/communication/Best Practices'. In the contextual filter I have set the case to 'lower case' and checked the box to 'Transform spaces to dashes in URL', however, neither of these things are doing anything.

In most cases the link to some content works fine but if there is a dash in the content title (e.g. 'online-led reporting') the content won't display.

How can I use an aliased content title with the contextual filter?


texts: Adding Information to Maintenance mode message

texts: I'm trying to setup my maintenance mode message so that it will display a twitter feed and a facebook like box to my sites facebook page. I want to do this so I have a place to send information to the people who need it or want to keep up to date while I do something that could have the site in maintenance for an extended period of time. I'm just wondering how I would set that up and if it's possible in the default maintenance mode settings of if I have to do something else, like a separate page or module.


texts:
I have enabled the i18n module and created a taxonomy vocabulary with translated terms. In addition I have created a CT (content type) in which I've added a term reference field of this taxonomy vocabulary.

Is there a way while I'm authoring a new content of this CT to have to choose only among the user's current language terms? At this point I'm seeing a list of 10x3 (30) terms 'cause I got 3 languages, and that's a bit of chaos for the authors.

Thanks in advanced, I hope I've been clear


texts: How to add another option to promote an article content to?

texts:
Take a look at my screenshot.

How can I make another option to promote my article contents to? Like promote my content as Affiliate Slideshow or to Slideshow?


texts: Composer does not install Calendar Module

texts:
Hi I am having trouble migrating my local site to development (two seperate servers). I believe the reason being is because I can not install an unstable Calendar Module, which I have on my local but not on my development. In my development site I git pull successfully and checked the repo https://www.drupal.org/project/calendar/releases/8.x-1.x-dev was running. I did composer require 'drupal/calendar:1.x-dev'. I also have "minimum-stability": "dev" in my composer.json.

When I run drush cr I get:

  [error]  The "calendar" plugin does not exist.

So it seems that I do not have calendar module downloaded. I check my composer.json file and have

"require": {
    "drupal/calendar": "1.x-dev"
},

but when I run

composer update

I get

./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
> Drupal\Core\Composer\Composer::preAutoloadDump
> Drupal\Core\Composer\Composer::ensureHtaccess

and nothing gets downloaded. Am I missing anything?

Any help or pointers would be helpful! Thanks in advance.


texts: 403 Forbidden when creating a page with RESTful API

texts:
Referencing this tutorial, I am trying to create a page with RESTful API:

{
  "_links":{
    "type":{
      "href":"http://www.example.com/drupal/rest/type/node/page"
    }
  },
  "title":[
      {
        "value":"My first page"
      }
    ]
}

The POST request is: http://203.80.250.46/drupal/entity/node

The POST request headers are:

Content-Type: application/hal+json
PHP_AUTH_USER: (admin_username)
PHP_AUTH_PW: (admin_password)

But Drupal responded with: 403 Forbidden (Access Denied in response HTML)

Drupal 8 is installed at: http://www.example.com/drupal/

Enabled: HAL, HTTP Basic Authentication, RESTful Web Services, Serialization, REST UI

What did I miss?


texts:
I have done a drupal theme and as of right now am only working with teaser and full view modes.  Both of which I have themed in the node--product.tpl.php file
I am interested in learning view modes to create different,  fully customizable layouts for different pages and products.

How and where to create a new view mode for a paticular node type ie. Node--product.tpl.php before themeing.  Is there a preferred module for this which doesn't limit themeing.
How and where to tell a given page ie. Page--front.tpl.php which view mode of a paticular node type to use.  Is there a module for this. As of now the product nodes appear under the content region.

How and where to theme the html of a view mode. Even if it's a template override. Right now I have the two view modes themed in a photo if else statement. The "if" being the teaser and the "else" being the full node.
Any tutorials or videos that stand out for this?


texts: Help with OOP for custom menu structure module

texts:
I've created an html/css/js component for an accessible dropdown menu. Now that I'm using it in a few different places, and one of those places needs to generate the links programmatically, I'd like to package it as a module. I have a general understanding of OOP, but I just don't really understand the kinds of files that I need for this or the src folders that they should go in.

The structure of the menu itself is essentially (plus some attributes that I know got lost in editing:

  <button id="menuIdTrigger" class="c-accessibleDropdownMenu__trigger" aria-controls="menuId" aria-expanded="false" aria-haspopup="true" data-state="closed">
    Menu Trigger Button Text
    ▼
  </button>

Menu Heading

        Link1 Text

        Link2 Text

One variant uses multiple
 elements with their own
 headings to further categorize the menu items. In most of my use cases, these menus are generated on the fly so I don't need to leverage Drupal menus (although that would be great to support at some point).

I'm fairly certain that the class(es?) I use to generate the markup shouldn't be a:

Controller, since they don't relate to a route
Block plugin, since the object itself should be able to be rendered wherever it is needed, possibly within blocks provided by other modules.
Entity or Form, because it is neither

Past that I'm just a bit lost on what my options are. I also see that Core has some classes just sitting right in /Core/lib -- is it a viable option to drop my class file directly into my module's src folder and call it a day or should it really be further classified/categorized.


texts: How can I set page specific user view access by user role?

texts: I need to be able to restrict access to specific pages based on user role, I heard that nodeaccess could do that, but I haven't been able to figure out how to do that with it, can you set page specific role access with nodeaccess? if not is there a module that can do that?


texts:
I have two template override - user-profile.tpl.php and views-view-fields--myviewname.tpl.php.
To take effect those templates, I had to place them into the default enabled theme.

The main problem is that I use the default theme "bartik" and I got to place them into "themes/bartik/templates/" to let the drupal theme system know them.
I know it is not a good idea because it is just like hacking. I should use a custom theme or sub-theme from bartik, but I don't want to write any theme.

The only clue is that I have a custom module and I shall put them into that module ( sites/all/modules/mymodule/templates ). Then, I shall make a theme suggestion to let the theme system use them.

How can I do this or any better idea?


texts: Building complex Javascript on top of but apart from Drupal

texts:
Does anyone have any thoughts on developing significant Javascript functionality on top of but separately to a Drupal site?

I have started working on an old Drupal site (dealing with written, news articles) and I have a few reasons for wanting to split off some development, primarily front-end features, into a different code base:

Accepting contributions from other developers (e.g. in an open-source fashion) may be easier and safer to manage if the front-end alone is being committed to.
The Drupal site is complicated and bloated. We need to push on with development, ideally collaboratively, but the Drupal site doesn't feel like the most modern or productive code base to work on.
I think it may be an interesting way to transition from Drupal by building the front-end exoskeleton over it.

I don't mean this to sound negative towards Drupal and I'm sure the techniques I'm looking for will benefit Drupal loyalists too.

What do I imagine?

Perhaps the front end-code base, open to public contributions, would include a bunch of javascript (perhaps even a framework app, e.g. angular) and stylesheets.

Ideally this would work within a continuous integration framework where commits to the front-end were tested in an environment containing the latest Drupal production code.

I'm looking for advice and experience. My questions are:

Is this feasible? Is it being done by any notable, ideally open-source teams? Other thoughts?
What features do you think this would work with and which not?
What technology and patterns should I consider, both on the front-end and on Drupal.


texts:
I'm looking for a module, integration or solution for parsing a resume on the profile fields.

Big companies like Monster.com and Indeed.com can provide you the ability to upload a resume and fill out all the fields of registration for you. One of my clients ask me for this feature on the website and I have no idea where to start.

Base of what I read online there are two module for parsing Parsing Api and Feeds extensible parsers but they do not exactly what I'm looking for.

I'm using the Recruiter Distribution and Profile2.

My goal is to be able to upload a resume and that resume will complete their resume (Profile fields) for them.


texts: Where do I set which template file to use for a block?

texts:
I know I can just override block.tpl.php using the normal template system. But is there a way to set the tpl file when I define a block in my module ?

I thinking of an equivalent to this:

function theming_example_theme() {
  return array(
    'theming_example_text_form'  => array(
      'render element' => 'form',
      // In this one the rendering will be done by a tpl.php file instead of
      // being rendered by a function, so we specify a template.
      'template' => 'theming_example_text_form',
    ),
  );
}


texts: How to facilitate meetings / events with participant registration, agenda and documents?

texts:
How to manage meetings in Drupal? I would like to do the following:

Participants can register for an event or be added by the admin.
The meeting has an agenda, consisting of a number of agenda points.
Documents can be attached to the various agenda points.
Participant details, the agenda and documents are shown.
Record that the meeting is one in a series of meetings of the same group.

An example of what is needed is here, but the site is Joomla and it seems to be a custom module.


texts: Is it possible to export my website to a native iOS/Android application?

texts:
I'm new to the EZPublish CMS and I see that he give you the facility to export your website into an Android or iPhone application.

Is there any way to do the same with Drupal?


texts: 7: Form API: managed_file: AJAX upload error "Undefined index ... in file_ajax_upload()"

texts:
I have a problem with "AJAX: add more file fields". The Problem: i create new managed_file field and add AJAX function "add more file fields". When i try to upload a file with first static file field, it works fine. But when use function "add more fields" and try to upload a file with AJAX created field, get error "Notice: Undefined index: ... in file_ajax_upload() (Line 262 in .../modules/file/file.module)."

All Answers for Similar Questions here don't solve this Problem.

The code:

<?php
/**
* implimentation of hook_form_alter()
*/
function mymodule_form_alter(&$form, &$form_state, $form_id) {

}

/**
* implimentation of hook_form_FORM_ID_alter()
*/

function mymodule_form_block_admin_configure_alter(&$form, &$form_state, $form_id) {
 // Since the form builder is called after every AJAX request, we rebuild
  // the form based on $form_state.
  $num_checkboxes = !empty($form_state['values']['howmany_select']) ? $form_state['values']['howmany_select'] : 1;
  $form['howmany_select'] = array(
    '#title' => t('How many checkboxes do you want?'),
    '#type' => 'select',
    '#options' => array(
      1 => 1,
      2 => 2,
      3 => 3,
      4 => 4,
    ),
    '#default_value' => $num_checkboxes,
    '#ajax' => array(
      'callback' => 'ajax_example_autocheckboxes_callback',
      'wrapper' => 'checkboxes-div',
      // See ajax_example_autotextfields for an example of 'fade'.
      'effect' => 'fade',
      // Don't show any throbber...
      'progress' => array('type' => 'none'),
    ),
  );

  $form['checkboxes_fieldset'] = array(
    '#title' => t("Generated Checkboxes"),
    // The prefix/suffix provide the div that we're replacing, named by
    // #ajax['wrapper'] above.
    '#prefix' => '
',
    '#suffix' => '
',
    '#type' => 'fieldset',
    '#description' => t('This is where we get automatically generated checkboxes'),
  );

  for ($i = 1; $i <= $num_checkboxes; $i++) {
   $form['checkboxes_fieldset']["slideshow_item_$i"] = array(
    '#title'    => t('Image')." $i:",
    '#type'     => 'managed_file',
    '#required' => FALSE,
    '#upload_location' => file_default_scheme() . '://mymodule_images/',
    '#upload_validators' => array(
      'file_validate_extensions' => array('gif png jpg jpeg'),
    ),
    '#tree' => TRUE,
    '#description' => t("Upload slideshow image. Allowed extensions: gif, png, jpg, jpeg."),
   );
  }
  return $form;
}

function ajax_example_autocheckboxes_callback($form, $form_state) {
  $form_state['rebuild'] = TRUE;
  return $form['checkboxes_fieldset'];
}

?>

I think the Problem is in $form_state. How i can refresh / rebuild $form_state? In ajax_example_autocheckboxes_callback i set $form_state['rebuild'] = TRUE; but without effect :(

Code Test Video:

http://www.youtube.com/watch?v=PtRiQorCTA4

I looking 3 days for a solution :-/

Helpful articles:

How to add more Fields using Form Api

https://drupal.org/node/752056

https://drupal.org/node/331941

How to wrap managed_file Form API element with custom HTML using #theme_wrappers?


texts:
In Drupal 6, I added a custom field and attached it to a custom post type. I added sample articles and sample data in that custom post type. I added that custom field to a view. On individual articles, the custom field data shows up. But on a template that shows the five latest articles does not show the custom field.

I put this on that template:

<?php
 print '<pre>' . htmlentities(print_r($rows)) . '</pre>';
?>

And the custom field does not show in the array as it should.

This is the field I'm trying to show:

So is there somewhere else I need to activate this field? Thanks in advance.


texts:
I have some custom block types that display in a region in my site. I have noticed that when changing the contents of these blocks, like an image, text, or title, that when you save and visit the page, the block data is cached and doesn't show the new changes. This is problematic because the client keeps reporting this as a bug, but I can't see where or why it won't update.

Is there a way to have it invalidate when saving a block so that a cache clear isn't necessary? I figured this would be normal behavior, but I have to clear it (while logged in as UID 1 even), and I don't think I am doing anything weird or have a contrib module installed that would interfere with this.

Edit: I am not using Panels or anything - this is core block.


texts: How to use daterange field programmatically?

texts:
I activated the Datetime Range core module and it works inside a content type, from the BO, but I want to use it in a custom form. I tried :

  $form['training_interval'] = [
    '#type' => 'daterange',
    '#required' => TRUE,
    // '#default_value' => 'TODO',
  ];

and also daterange_default, datetime_range and any value which could have been relevant giving the module code, but nothing is displayed. I must confess I feel silly...


texts: Is there a way to limit / enforce permissions on image style downloads?

texts:
I have a few image styles that I only want certain node types to be able to view because certain images on my site have an open license for use and so I have a style for a large image gallery view, while others do not and so they shouldn't use this style.

The images, and the image styles are stored in private locations and served through Drupal.

Is there a way I can set conditions on when an image style can be downloaded for an image; for example by node type, a field flag, or who a user is logged in as?

Is there another solution to this issue?


texts: Define available default colors for Color Field programatically

texts:
I use the Color Field as a field in a custom module from where I create the content type programatically.

By default the available colors are defined at this hook:
color_field_field_settings_form

in the color_field module.

I need to modify the list of available colors and I wanted to do at the field creation time.

At my _slider_installed_instances function I have:

EDIT: Added the settings section with no results.

        'slider_background' => array(
                'field_name' => 'slider_background',
                'type' => 'color_field_rgb',
                'label' => $t('Slider background color'),
                'widget' => array(
                        'type' => 'color_field_default_widget',
                ),
                'settings' => array(
                        'default_colors' => array(
                                'default_value' => '#AC725E,#D06B64',
                        ),
                ),
                'display' => array(
                        'default' => array(
                                'label' => $t('Slider background color'),
                                'type' => 'text'
                        )
                ),

        ),

and I wonder how to define the settings for default colors so the list will be the one defined by me at my module.

I'll appreciate any hint.

Thanks in advance.


texts: Ctools form submission json response broken by VPN

texts:
I have a ctools modal form implementation in my intranet site which works normally within the office premises. However when accessed from outside using a VPN, the submission seemed to fail without showing the success message. We then discovered that the form submission response through VPN contained script tags appended to it like

<SCRIPT language="javascript" id="dsshim" src="/dana-cached/js/shimdata.cgi"></SCRIPT>
<SCRIPT language="javascript" id="dstimeout" src="/dana-cached/js/sessiontimeout.js"></SCRIPT>
<SCRIPT language="javascript" id="dsvar" >
//<![CDATA[......[{"command"...

This causes error in parsing the json response and makes it look like the form submission is still in process instead of showing the form submission message.

While looking for similar issues I came across this thread reporting on the same problem stating that the script tags would be appended while using Content type: text/html and should use application/json instead.

I am currently checking for ways on the drupal end to prevent this from occurring and would appreciate suggestions on the same.


texts:
I am interested in getting the average count for a node.
Currently I am able to show the nodes rating with:

$fivestar = field_view_field('node', $node, 'field_cg_rating', 'basic');
render($fivestar);

But I just want to get the count instead of the entire html showing the vote. Just a numerical value.

Is there an easy way of doing this?


texts: How to change wrong English sentences in contributed module?

texts:
Sometimes we find grammatically wrong English sentences or spelling mistakes in some contributed modules. While doing translations, we can translate the way we want.

But how to change these kind of sentences or words, also if the client wants to change it in English? As we know, we can't do changes even in contributed modules.

So, do we need to write custom module or use String Overrides module or contact the maintainer/contributor?
Which is the best way to do it?


texts: How to render a page with arrays and text

texts:
I'm writing a module, which gets called from a MENU_LOCAL_TASK hook.

function load_statistics(){
    $page = display_yes_no(10,40);
    return $page;
}

the $page is an array used for rendering with Charts API, the problem is that if I do

$page .= 'hello';

for example, it's displaying "Arrayhello" instead of the graph and hello. How can I render the page the in drupal, to display both text, both charts?


texts: How do I have views exposed filter results in separate block?

texts:
I know how to expose the Views exposed form on a block but what I would like is for the results from the exposed filter be shown as a separate block.

For example:

User will go to www.example.com/search_names
On this page they will see an exposed filter where they can enter a name and hit Apply
After the user clicks Apply the results are shown in a different block.

Thanks for any help.

I'm thinking that I may be missing a step in the process. Here are the steps I am taking and the order I am doing them:

Add New View and click on CREATE BLOCK on the Add New View page. (Both have display format of GRID)
I add my fields that I want to show in the filter result.
I add my Filter Critea and choose "Expose this filter to visitors, to allow them to change it "
I click on Advanced and under Expose Form In Block I choose YES.
Under Exposed Form Style I choose  Input required.
Under Use Ajax I choose Yes.
At this point, in the Preview section I no longer see my Filter Critea.
I save my View.
I now go to Structure then Blocks and can see 2 new blocks under Disabled: Exposed form: view_name-page and View: view_name
I assume that the one starting in Exposed form is the Filter Critea (where the user can put in the search paramater) and the one starting in View will be where the results of the Filter will be shown.
I place the Exposed Form block in the Content area of my theme and under Pages I input the node where I want this block to ONLY appear in. (In my case node/109).
I go back to the Blocks page and then place the View in the Content Area of my them and under Pages I input a different node where the results will be shown. The reason I have a different node is because on this node I have text that pertains to the filtered result.

I go to the node where I have the Exposed Form (node/109) and see the Filter Request. I type what I am searching for and hit apply. The results IS NOT appearing under the node where I placed the View block. Why is this?

Thanks for any help.


texts:
I uploaded my site and the database on the remote server; the site is working in locale, but on the remote I get the following error.

  PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'queryfdu_drupal7.watchdog' doesn't exist: INSERT INTO {watchdog} (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9); Array ( [:db_insert_placeholder_0] => 0 [:db_insert_placeholder_1] => domain [:db_insert_placeholder_2] => Domain access failed to load during phase: bootstrap include. Please check your settings.php file and site configuration. [:db_insert_placeholder_3] => N; [:db_insert_placeholder_4] => 3 [:db_insert_placeholder_5] => [:db_insert_placeholder_6] => [:db_insert_placeholder_7] => [:db_insert_placeholder_8] => 122.175.149.244 [:db_insert_placeholder_9] => 1434778958 ) в функции dblog_watchdog() (строка 160 в файле /home/queryfdu/public_html/drupal/modules/dblog/dblog.module).

The watchdog table exists in the database.

How can I fix this problem? What could be causing it?


texts:
I'm trying to create this button in my views with a custom text, that needs to link to the current node.

I know you can use links and that works, but.. i need something like a variable that makes the link always go to the current node.


texts: Exclude a node from being indexed with search_api

texts:
I've read over How to exclude a node from being indexed based on a field value? and I believe I've done exactly what it says. Yet, the nodes I don't want to have indexed are still in the index. Here's my code:

function mymodule_search_api_index_items_alter(array &$items, SearchApiIndex $index) {
  foreach($items as $id => $item){
    debugToFile("Looking at part " . $item->title);
    if(1 == preg_match("/^[A-Za-z][A-Za-z]-/", trim($item->title))){
      debugToFile("   IGNORING ABOVE");
      unset($items[$id]);
    }
  }
}

Some notes: I want to exclude any node where the title starts with two capital letters followed by a hyphen. The debugToFile function does just that. Through it, I see that I am entering the if block when I should be: I see "   IGNORING ABOVE" just below all parts that SHOULD be blocked. However, after I blow away the index and reindex everything, I STILL have those nodes in the index.

Help??


texts: Use CKEditor for textareas in custom form

texts:
I'm using the CKEditor module, and I would like to have the CKEditor in my custom textarea. I tried hard but it just doesn't work...

This some of the code I tried:

    $form['body'] = array (
        '#type' => 'textarea',
        '#title' => 'Item Snippet',
        '#default_value' => $body,
        '#cols' => 80,
        '#rows' => 7
    );
    $form['']['format'] = filter_form();


texts: Regcode/OG Issue - Need D7 Equivalent of og_all_groups_options()

texts:
I'm trying to use the Registration codes module to automatically assign users to an organic group when they login with a registration code.

For Drupal 7, it appears that the Registration codes module is still using a Drupal 6 function (og_all_groups_options()) that is supposed to list all organic groups on a form.

I need to know the D7 equivalent of this function; I can't seem to find it.
Do you have a suggestion for how I could print out a multi-select option list of organic groups like og_all_groups_options() did?


texts: Custom create account form included in a create content form

texts:
I am new to Drupal 7 ( 1 month ) and have to do a rather complex task.

I have a content type (lets call it MyContent) for which i tried to create a custom form (I imported the fields from the original add content form in my own custom module generated page) which contains, among other fields, an email field, and i need to add 1 more field called password. With these 2 fields , i want on form submit:

*IF the email & password combination does not already exist

-> first create a user account taking the email as username and password as password ,
-> then create the content(disabled),
-> then make the site visitor confirm his email to enable his account
-> and after validation make the content viewable by all

*IF the email&password combination exists then :

-> create the content viewable

all of this by clicking one button.
The general ideea is that i want visitors, who are not logged, to be able to create content but in the process , get a user account generated as well. Also if the visitor already has an account then the email&password will work as a validator for letting the user create more content.

Is it even posible? I saw that Drupal has a lot of configurable options for users but nothing close to such a crazy ideea.


texts: Field collection template file no output on render

texts:
I'm using Drupal 7 with field collection module. I have the template files set up and rendered with a call to render(). However, even though the templates are executed, the output is thrown away.

This is the code in the template file

<?php trigger_error(basename(__FILE__)); //wtf(bt());die; ?>
<?php if ($element['#items'][0]['value']) { ?> gray<?php } else { ?> not-gray<?php }
//ob_end_flush();//die; ?>

The field type is list_boolean and there is output no matter what the value is (if/else). trigger_error(basename(__FILE__)) is just to check if the file is even being interpreted, which it is.

When I uncomment the line calling ob_end_flush(), the output is rendered,  but the header region fails to output, clearly disrupting the output buffer stack.

Is there some kind of field collection output buffering going on that I'm unaware of? If it is so, can it be disabled?

The following is the code for my various template files.

node--about_us_page.tpl.php

<?php print render($content['field_content_section']);?>

field--content_section.tpl.php

<?php foreach ($items as $item) print render($item); ?>

field-collection-item--field_content_section.tpl.php

<div class="sub-section<?php print render($content['field_gray_background']); ?>">
    <?php print render($content['field_section_title']); ?>
    <?php print render($content['field_content_column']); ?>

field--gray_background.tpl.php

<?php trigger_error(basename(__FILE__)); //wtf(bt());die; ?>
<?php if ($element['#items'][0]['value']) { ?> gray<?php } else { ?> not-gray<?php }
//ob_end_flush();//die; ?>


texts: Render a content based on access permission

texts:
I have two content_types,Type_A and Type_B. I have referenced one field in Type_B to Type_A by using entity reference type. But when the particular Type_A node is not published,then also anonymous user is able  to view the field from Type_B.

To display Type_B contents I am using themes help and rendering all the fields. So What I want is, if the Type_A content is not published then that particular entity referred field in Type_B should not display to anonymous user. So how can I achieve that in theme file,any suggestions will be appreciated.


texts: Having issues getting solr search facets to appear on non-search pages

texts: I'm using the solr search integration module with facet api on drupal 7 and I'm having issues getting the facets to show on non-search pages. I've checked the box for non-search pages and added a few different paths but nothing appears on those pages in the regions that I assign the facet blocks.  It seems that the blocks are not receiving any data to populate and I don't know why. Any incite on what I'm doing wrong would be greatly appreciated.


texts:
I have set up events with calendaring on my site along with an agenda view. Each event has a date, possible start time, possible end time, and possible end date/time.

Therefor I have two date fields associated with this content type - field_date(value, value2) where value is the start date/time and value2 is the end date/time.

How can I show dates and times separately so that I can use CSS to make a pretty agenda view using something like the following markup?

September 21

Fall Solstice (all-day-event)

October 18

Fall Festival

10:00 am to 11:00 pm

October 21-25

Sign up for pie eating contest

9:00 am to 4:00 pm

I've looked at using the formatter module (explained here: how do I add extra classes to a date field at views?) but could not figure out how to use the formatter with two date variables for my Event content type.

Any help?


texts:
I'm using the Drupal Commerce, Checkout redirect and Auto assign role modules.

When a checkout is completed by an anonymous user on a Drupal Commerce website a Drupal account will be created.

If there is only one product everything is ok, but what happen when there are many products?

How can I make it so that:

If a user buys "Product 1" I will be auto-assing a role "Role 1"
If a user buys "Product 2" I will be auto-assing a role "Role 2"

Could anyone solve this question?


texts:
We have got a multisite structure with several sites. One of the sites has got a webform, from which client needs to download submissions from time to time. However, when we choose to export to Excel using the default values (delimited text and \t as delimiter format), Turkish characters get corrupted on a Windows. I have got no trouble on Linux, but client uses Windows. I must also mention that this behaviour doesn't occur on another site in the same multisite structure. What could I be missing?

EDIT: We are running Drupal 7.34, Webform 7.x-3.21, PHP 5.2.17, and we are using MS Office 2007. I export to Excel using /node/%nid/webform-results/download. I have also tried exporting the Webform to another site on the same multisite structure (hence the same PHP version) and verified it works fine there.
Regards,


texts:
Sometimes when I try to apply a hook, just to realise it's supposed to be in a module file.

Is there a way of knowing what hooks can be implemented in a theme's template.php file, or one in a module?


texts: Create a view block for display of taxonomy term children

texts: I am trying to create a View of Taxonomy Terms which lists the child terms for the currently displayed term.  Is this even possible for taxonomy terms or is it only possible for Content Nodes?


texts: Is there a way to modify attribute options with a percent value?

texts: I'm using Drupal Ubercart and I have created an attribute that should affect the price of the product using the attribute. The problem I have is that out of box, it can only affect the price by adding or subtracting a value. I wish to affect the price using a percent-value. Is there a "clean" way of achieving this?


texts: How to reload a node page after Comment submit

texts: I'm using AJAX Comments to allow users to submit command using AJAX. I want to refresh the page after comment is submited.


texts: arg() and menu_get_object() are incorrect

texts:
So, I have a module with a very plain hook_block_view in it. The hook contains definitions for around 12 blocks.

If I var_dump(arg()) at the top of the hook and load a page with 3 or 4 of these blocks, I see something odd;

array (size=2)
0 => string 'node' (length=4)
1 => string '67739' (length=5)
array (size=2)
0 => string 'node' (length=4)
1 => string '67739' (length=5)
array (size=1)
0 => string 'current-player' (length=14)

The same happens for menu_get_object(), I get node object, node object, then null.

The path 'current-player' is defined in another modules hook_menu and is simply a redirect to the page I'm on with these blocks.

Why, on the same page, would hook_block_view have different results for arg() and menu_get_object? I can confirm that the page path has not changed, it remains the same for the load.


texts: How to alter the output of a file-field as a custom field-widget

texts:
I am implementing a custom field-widget for the file-field in Drupal 8.

I extended the FileWidget class as my widget uses most of the file-field-widget functionality.

There is just a small part I want to theme/customize from the file upload form, the part I marked in the following screenshot:

What is the best way to alter the output from a field-widget?

I want to add some surrounding container elements and similar things you do in a theme function.


texts:
I'm working on upgrading an old site. I've just upgraded from 6.17 to 6.33. Most things seem to be working, including some views, however one view is throwing the error below. I agree that there's no node_data_field_image table in the db, but there isn't one in the pre-upgrade backup, either. Any ideas?

Unknown column
    node_data_field_image.field_image_imceimage_title
in field list query:

SELECT DISTINCT
    node.nid AS nid,
    node.title AS node_title,
    node.uid AS node_uid,
    node.type AS node_type,
    node_revisions.format AS node_revisions_format,
    node.created AS node_created,
    node_data_field_image.field_image_imceimage_path AS node_data_field_image_field_image_imceimage_path,
    node_data_field_image.field_image_imceimage_width AS node_data_field_image_field_image_imceimage_width,
    node_data_field_image.field_image_imceimage_height AS node_data_field_image_field_image_imceimage_height,
    node_data_field_image.field_image_imceimage_alt AS node_data_field_image_field_image_imceimage_alt,
    node_data_field_image.field_image_imceimage_title AS node_data_field_image_field_image_imceimage_title,
    node.vid AS node_vid,
    node_revisions.body AS node_revisions_body,
    node.sticky AS node_sticky,
    DATE_FORMAT((FROM_UNIXTIME(node.created) + INTERVAL -14400 SECOND), &#039;%Y%m%d&#039;) AS node_created_day
FROM node node
LEFT JOIN node_revisions node_revisions
ON node.vid = node_revisions.vid
LEFT JOIN content_field_image node_data_field_image
ON node.vid = node_data_field_image.vid
WHERE (node.type in (&#039;news&#039;)) AND (node.status = 1 OR (node.uid = 1 AND 1 &lt;&gt; 0) OR 1 = 1)
ORDER BY node_sticky DESC, node_created_day DESC LIMIT 0, 5

in /home/rsage/rs_upgrade/sites/all/modules/views/includes/view.inc on line 810.


texts: Can I create a text field which is both a autocomplete taxonomy, and a freetagging field

texts:
I want to let my users store a list of their interests. I don't know what they are going to say (or how many interests) so I am going to let them create their own, preferably as one big comma separated list.

But I'd also like to have those interests as taxonomy terms so that I can find users later on based upon their interests...

Can you suggest a way of doing that?

It would be best if the field was autocomplete too to reduce the number of variants so for example I might type into my interests field

Books, Movies, Hitch

and if the system has other people interested in "Hitchhikers Guide to the Galaxy" then it offers that to me, along with "Hitchhiking", "Hitch (film)" and so on...

(In case you are familiar with it what I am describing is very similar to the LiveJournal interests field)

I am using Drupal 7, Profiles2, and MySQL. I might consider writing a custom module for this if that is the only way, but only if there is demand for it elsewhere.

Hey- thinking about it I'd quite like the way that this site does its tagging of posts..... :-)


texts: How do I change value of a boolean field on a node when a user clicks a button?

texts:
I am building a small site for a friend who is getting married and they have their gift list online. Each gift is a node which I am thinking will have a boolean field called something like "bought". The functionality I want to create is that visitors can look at a list of gifts and, if they want to buy something for them they just need to click a button next to it.

So my question is simple, can I change the value of a node field when a user clicks a button?


texts: Access multiple values by index in a view

texts:
I have a multi-value field. When I output this field in a view I use Rewrite results and reference this field as [field_product_image]. This outputs all the images of the field.

How could I output only certain element of this array, e.g. second image using rewrite results (this is essential)?
Neither of these works:

[field_product_image:0], [field_product_image_0], [field_product_image-0]


texts: How to navigate URL after moving drupal site from one server to other server?

texts:
I have just moved my drupal 7 website from one server to other server.
But after moving it i am not bale to see any css effect and not able to open naviagte any link. I am using linux server.

Can somebody suggest how to do this.


texts: entityQuery with multiple conditions on taxonomy terms returns no result

texts:
In my use-case I have an entity which has two fields that reference to unique vocabularies.

News:
 - tag (entity reference)
 - category (entity reference)

If I query on one of those reference I get results however when I query both (an AND filter) I get no results. I have triple-checked it by now and there are entities that contain both the tag and category I am querying.

Is this an user-error or a Drupal bug?

$query = \Drupal::entityQuery('node')
    ->condition('status', 1)
    ->condition('type', 'news')
;
$group = $query->andConditionGroup()
    ->condition('field_tag.entity.name', ['cars'], 'IN')
    ->condition('field_category.entity.name', ['sport'], 'IN')
;
$query->condition($group);
$nids = $query->execute();

EDIT:
I have found a work-around by querying on the raw value instead of entity.value. This is a non-desirable situation though

$query = \Drupal::entityQuery('node')
    ->condition('status', 1)
    ->condition('type', 'news')
;
$group = $query->andConditionGroup()
    ->condition('field_tag.entity.name', ['cars'], 'IN')
    ->condition('field_category', [1], 'IN')
;
$query->condition($group);
$nids = $query->execute();


texts: How to expose paging data in REST export views

texts:
How to allow views to export paging data along with entities?

I can set pager, and it works of course, for example my_view?page=1
displays something like

[
  {...},
  {...}
]

but I only get list of filtered or paginated entities, and I would like to include paging information, something like

[
  paging_info: [
    total: 4,
    per_page: 2,
    current_page: 1,
    ...
  ],
  data: [
    {...},
    {...}
  ]
]


texts:
If I, hypothetically, ran a business and kept data on products, part data related to those products, and service procedures for those products would it make sense to fit this into the Drupal taxonomy? Is that the Drupal way?

I'm just getting going on Drupal; I have an existing working php application that I shoved into a module without really making use of Drupal functions, to the extent that I even have a separate database. My app uses some non-trivial database organizations, lots of database views and heavy usage of inner joins. This app will be a suite of apps that will also include standard web functions, which I why I want to use Drupal/CMS. But I don't know if I should my module data into taxonomies.

Edit: 99% sure that entities will do what I need, searching on that now.


texts:
I got the error

  Fatal error: Class 'RulesEventSet' not found.

I got this error on installing the views_custom_conditions module module.

Please let me know the cause of this error as I Googled but didn't find the solution.


texts:
Is it possible to bootstrap a particular drupal 'settings.php' ?

I've gotten bootstrap to work with the default site only.


texts:
How do I use Url::setUnrouted() in a custom module?

If I call this method I get the following error:

  Call to protected method Drupal\\Core\\Url::setUnrouted()


texts: How to add collapsible help text to a form?

texts:
I would like to add some collapsible text underneath my comment forms. Preferably, users can click a small icon, which reveals the help text. After reading https://stackoverflow.com/a/8405715/2625920, I already added a paragraph at the desired position:

function MYTHEME_form_comment_form_alter(&$form, &$form_state) {
  $form['markup'] = array(
    '#markup' => t('
Here is some very useful text.
'),
    '#weight' => -1,
  );
}

(Actually, it surprised me that this works, since #markup is not ticked for forms in the Form API Reference...) Unfortunately, simply adding

'#collapsible' => TRUE,
'#collapsed' => TRUE,

to the array does not work (which is expected according to the Form API Reference). Any suggestions?


texts:
How can I change the ID of a hidden element (created with the Drupal 6 webform module) using hook_form_alter()?

The ID that it outputs is something like '#edit-submitted-component-name'. I need the ID to be something very custom and I need to avoid changing it with Javascript. The form API does not support the #atrributes token on hidden elements, so I can't set the ID via hook_form_alter();

Any suggestions would be really helpful. Thank You.


texts:
I have been creating a lot of code in the past few months for my Drupal 6 website and have since created about 20 modules of code that all pretty much go together.

I know we can group modules together in a folder, but am wondering what impact this will have if I do this on already deployed modules.

Is it possible for me to simply create a new folder in the sites/all/modules folder and move all my modules in this new folder? Will Drupal handle this properly?


texts: How to prevent Cross Site Scripting when input using "Full HTML" mode of CKEditor

texts:
I am using Drupal version 8.3.7 and ckeditor 4.11.3.
I create a basic page contains some scripts as following:

In the detail page, I can see that the script in onmouseover="alert('222222')" is executed when I move my mouse over the "click" text.

Hacker can easily add a malicious script by this way. How can we avoid this ?

Issue is not only for "Full HTML" mode, but also other modes if we configure a proxy between browser and server to change the encoded value to the raw value.

For example, if we select the "Unfiltered HTML" mode and we input click to the body field. When we save the page, the body value will be sent with a POST request that it is HTML encoded: &lt;a href=&quot;#&quot; onmouseover=&quot;alert(&#39;111111&#39;)&quot;&gt;click&lt;/a&gt;. But in the proxy above, we configure to change the encoded value to the raw value. Then the raw value click is saved into DB which will cause the same issue with "Full HTML" mode.

A solution that we can encode the output in theme preprocessing hook. But it seems require us to add a lot of codes because our system may have many entity types and fields.


texts: Which PHP file would a custom theme_link function go into?

texts:
For some Taxonomy term pages I would like to change the "Read More"

link to "More info". Using theme developer, I see it’s using the theme_link function and gives a candidate function name.

If I re-write this function, in which PHP file would I put this custom function?


texts: Naming conventions for Drupal permissions

texts: Looking through the Drupal coding conventions http://drupal.org/coding-standards#naming I have seen module, variable, function, and many other areas but not for permission names. Are there any conventions to the Drupal 7 permissions hook to keep from creating permission names that might interfere with others?


texts: Why can't I install even if I have the required PHP version?

texts:
I want to install Drupal 9.0.2 on a server with Apache2 and PHP 7.3.2.
I am getting this error.

Your PHP installation is too old. Drupal requires at least PHP 7.3.0. See the system requirements page for more information.

The version I get with php -v is the following.

PHP 7.3.20-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Jul  9 2020 16:34:09) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.20, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.20-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

Why does the installer says the PHP version is too old when php -v says it's PHP 7.3.20?


texts:
How would I unset this menu item: Content > Add Content > Article

I would like to programmatically disable that path-page (node/add/article), or even better use that path for another page. I tried using hook_menu_alter(&$items). Does not work for that path, while on others custom menu items that I created using hook_menu it does work.

Update:
This is simple code that I tried (unset the $item key):

mymodule_hook_menu_alter(&$items) {
     unset($items['node/add/article'])
}


texts:
I can update Drupal 7 websites core with following instruction  from "How to update Drupal core".

Make a backup of your Drupal instance (database). (For ex: with MySQL)
Download the latest release of your current Drupal version.
Extract the [tar ball or zip] Drupal package.
Set your site on maintenance mode (For ex: How on D7)
Delete all the files & folders inside your original Drupal instance except for /sites and its sub-folders. This assumes that all of your custom work - including themes - is in the recommended spot - the /sites folder tree. If you have made custom changes elsewhere you will need to either preserve them or plan to replace them later.
Copy all the folders and files except /sites from inside the extracted Drupal package [tar ball or zip package] into your original Drupal instance location.
Some updates do not include changes to setting.php and some do. See There is a way - Comment below for more on this. If the update release includes changes to settings.php you will need to replace your old settings.php in .../sites/default/ with the new one, and then edit the site-specific entries (eg database name, user, and password) in the setting file.
If you have modified files such as .htaccess or robots.txt re-apply those changes to the new files.
If you have a favicon.ico file that was deleted replace it too
Login to your site as administrator or as user no 1
Run update.php by navigating to http://...yourdrupalsitename/update.php and follow the process to update your Drupal instance
Disable maintenance mode

I want to know the instruction for updating Drupal 8 core (e.g. from 8.0.0 to 8.0.2). How do I do it?


texts: Why multilingual site url is not working in production site?

texts:
I have multilingual site such as www.demo.com and bn.demo.com it works fine at dev and local site. but when i deployed at production it's url language is not working.

When I hit www.demo.com it goes english site. and then when i hit bn.demo.com it should come at bangla site but the strings are not translated.

Surprisingly when I logged in then switch url the translated string works fine. Why it does not works at logged out situation? how can I resolve it?

And my .htaccess files and rewrite condition

# (http://example.com/... will be redirected to http://www.example.com/...)
# uncomment the following:

RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^(www|bn)\. [NC]
RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]


texts: Apache solr search words, but the search pages yield no results

texts:
I have Drupal 7 set up with Search API and Apache Solr.  It was working for a while but after a lot of configuration has been done, modules installed, etc.  The search no longer yields results.  I added solr auto complete to my search block that uses the solr search, and when I start typing in "pizza" it shows that there are indeed two results that come from that search, but when I click Submit, the search page says there are no results.

Does anyone have any idea why this is not working?

EDIT: I also have facet search enabled.  To troubleshoot I disabled the facet api entirely and I'm getting the same issue.

EDIT2: Let me know what other information is needed to diagnose the issue.


texts:
I want the logo on my site to go somewhere other than the home page, but I can't seem to figure out where to change that.

I'd appreciate any help you can give


texts: How to set custom markers with Openlayers?

texts:
I'm trying to set my Openlayers markers to custom icons. I have looked at the Openlayers Examples, and I have added a new style of type Icon and then I have added an assets folder inside the Openlayers module directory. I then have set the path to the marker in the style settings tab.

The problem is that no matter how I configure the path, the marker doesn't show up in the style preview or on my map.  I have tried the full site path for the marker, I have tried the path from the drupal root, and I have tried the path from the Openlayers module folder. None of these work.

As always, any advice is appreciated.


texts:
I want to get all articles content type, but I want to get it randomize, how can I do that? Refer to my code below:

$nids = \Drupal::entityQuery('node')->condition('type', 'articles')->sort('RAND()')->execute();

I'm using drupal 8


texts: How can I include Google Structured Data via a module?

texts:
Looking through Google's suggestions of search optimisation for a site that I control, I would like to add their "Structured Data" JSON to various pages on the site. Their suggestion is to include the data in custom script tags:

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Organization",
  "url": "http://website.com",
  "logo": "http://website.com/logo.png",
  "contactPoint": [{
    "@type": "ContactPoint",
    "telephone": "+44 1234 567890",
    "contactType": "customer service"
  }]
}
</script>

What I can't work out is how to include this data "the Drupal way". I tried adding it as a library (thinking I'd later use DrupalSettings to customise the contents) but that includes it as a standard "type=javascript". How do I add it to the page header with the correct script type?

Google ref: https://developers.google.com/search/docs/data-types/corporate-contact

(answers giving a module that does this already are also welcome!)


texts: I modified a field dependency on my Call content type. Features did not track the change automatically. I cannot figure out how to manually add it to features.


texts: How to add Attributes to the input tag of a field

texts:
I am trying to find out how to modify a text input for one field of a quiz so that I can disable spellcheck.

Can I create a .tpl.php and add it to my theme folder to override it?

At the moment, it looks like the following:

<input autocomplete="off" type="text" id="edit-question-832-answer" name="question[832][answer]" value="" size="60" maxlength="256" class="form-text">

I simply with to add the following attributes to just that one field.

<input autocomplete="off" autocorrect="off" autocapitalize="off"  spellcheck="false"/>

I have looked inside modules/field/theme/field.tpl.php but do not see a way to modify the way text input fields are handled.

Which file am I supposed to edit to make this happen for a specific field?

Thank you.


texts:
I need to execute these SQL instructions.

CREATE TABLE superstatistics_counter LIKE node_counter;
INSERT superstatistics_counter SELECT * FROM node_counter;

When I run the query, it runs. I expect the node_counter table to get a big table with about 100000 rows.
This is what I have tried:

With hook_schema() I have created the superstatistics_counter table
With this code I tried to copy data from the node_counter table

$sql = "SELECT * FROM `node_counter`";
$data = db_query($sql)->fetchAll();
foreach ($data as $dataObject) {
  $dataArray = array($dataObject->nid, $dataObject->totalcount, $dataObject->daycount, $dataObject->timestamp);
  $query = \Drupal::database()->insert('superstatistics_counter');
  $query->fields([
    'nid',
    'totalcount',
    'daycount',
    'timestamp'
  ]);
  $query->values($dataArray);
  $query->execute();
}

It caused the following error:

  Maximum execution time of 120 seconds exceeded

So it is very slow.

When I executed it in phpMyAdmin, it output the following.

  MySQL returned an empty result set (i.e. zero rows). (Query took 0.1401 seconds.)
  CREATE TABLE superstatistics_counter LIKE node_counter

  100000 rows inserted. (Query took 0.9567 seconds.)
      INSERT superstatistics_counter SELECT * FROM node_counter

Is there a way to just execute this query in Drupal, without using db_query() and \Drupal::database()->insert()? Can it be done on MySQL side?


texts: node API hook that can be used to alter fields before loaded by Views?

texts:
I need to use a node API hook to alter some node content before it's displayed, in Drupal 7.

It just occurred to me though that if I used hook_node_view() it will not effect the output of a View that display's those nodes fields (right?).

I need to alter the fields in both the display of the node and the node's display in any views. Hopefull this can be done in one function, and not have duplicate code in both hook_node_view() and hook_views_pre_render() or function hook_views_data()whichever hook is used.


texts:
We have a page that uses several themes, but the 404 pages should all look the same.

So, for all themes except one we need a rule that switches to another theme when the URL does not match any content.

There are ways to choose the theme by the current URL, like using the context module, or implementing a ThemeNegotiatorInterface, and we use them to assign our themes to certain parts of the website.

It seems that the ThemeNegotiatorInterface is not used when delivering a 404 error page.

So, how can we switch the theme according to the http status code?


texts: Create a MySQL view table on one database but fill with results from another database

texts:
I have 2 databases: myshop (the Drupal db) and myshop_migrate (the Migrate db).  To make things tricky - both databases reside on different AWS instances.

I need to create a mysql view on myshop to hold a SELECT * query from the myshop_migrate database.

Currently, I have:

db_set_active('myshop_migrate_db'); //reference migrate db
$query = db_query('CREATE OR REPLACE VIEW myshop_migrate_stock_commerce AS SELECT * FROM myshop_migrate.stock_commerce');

but this just creates the VIEW table on the myshop_migrate database (as the current active db is referencing myshop_migrate)..

db_set_active(); //default drupal db
$query = db_query('CREATE OR REPLACE VIEW myshop_migrate_stock_commerce AS SELECT * FROM myshop_migrate.stock_commerce');

This wont work because myshop_migrate.stock_commerce doesn't exist on the myshop database!

Completely lost on this.  Can I somehow store the result of the SELECT * from myshop_migrate in a variable? Switch the active db, create a view table on myshop, then import the variable into the table?


texts: Portrait or Landscap for mobile and tablet

texts:
Is it possible to somehow get landscape/Portrait detection when using module mobile detect.
The issue thing is that I want to make different Panel Templates for Mobile; Landscape/portrait

I have found this php-code, see below, who gives the pixel of X and Y. With a compare of ($Y < $X) you can get the "Landscape" detection.

Is there anyone who knows any way to get this to work with panels everywhere and the theme; Adaptive Theme, so you can distinguish the views to different templates in Panels or Panels Everywhere?

 // everytime you want to find out the size of the screen, write the following 2 lines:
ncurses_wrefresh($fullscreen);
ncurses_getmaxyx ($fullscreen, $y, $x );

I think the future of design demands a possibility to make different design for especially mobile landscape/portrait. Google said on a conference year 2003 "that 65% of all first visit on a home-page are from a mobile devices" .

Premium solution is to optimize the interface by this facts, and there is a big difference between landscape/portrait when it comes to design and communications solutions.


texts: how to add existing taxonomy in custom form

texts: I have a dependent drop down created using taxonomy and hierarchical select in Drupal 6. I want to add this in a custom form. Is this possible?


texts: Profile 2 fields not displaying in registration form

texts: I create 2 Profiles with distinct Fields as well as assigned each one a unique role with permissions to Administer Profile2 registration paths, but all I'm getting is the default Username and E-mail fields nothing else (On both of them).


texts: Display a thank you message instead of a page redirect after submitting a Webform in a block?

texts:
I am using the Webform module, and I've created a block containing a webform. When I submit the form, my browser goes to the main url for the webform.

How can I display a thank you message instead?


texts:
Configurations:

"drupal/core": "8.4.3",
"acquia/blt": "8.9.10",
"acquia/lightning": "2.2.5",

I am trying to run migration of workbench moderation to content moderation on drupal core version 8.4.3, Install that module wbm2cm and run below the commands,

$ drush wbm2cm-save
$ drush wbm2cm-clear
$ drush pm-uninstall workbench_moderation
$ drush en content_moderation
$ drush wbm2cm-restore

After run drush wbm2cm-restore getting the error:

  InvalidArgumentException: The specified translation (fr) cannot be
  removed. in Drupal\Core\Entity\ContentEntityBase->removeTranslation()
  (line 901 of
  /var/www/cgicom/docroot/core/lib/Drupal/Core/Entity/ContentEntityBase.php).
  The specified translation (fr) cannot be removed.
  (/var/www/cgicom/docroot/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php:805)

My References:
https://atendesigngroup.com/blog/fixing-invalid-translations-drupal-8-content-moderation
https://www.drupal.org/project/entity_clone/issues/2984049

Here I am not getting the solutions. Please can anyone suggest me?


texts: What is the proper way to show a visitor an error?

texts:
I'm using a custom submit handler for a Webform, which POSTs important form data to another API. That part works, but on occasion there may be random network errors that prevent a successful submission, such as if the REST endpoint happened to be down at that particular moment (or whatever).

In those cases, I don't want the user to think their form successfully submitted when it didn't. How can I override the confirmation page with a custom error page? I tried drupal_set_message(), but it doesn't show up anywhere on the confirmation page that I could see.

Ideally, I would also be able to get back the event ID generated by watchdog logging so that the user, if they contact us by phone or email upon seeing the error, would be able to provide more information that can help us debug it.

So in summary, in a perfect world, a failed submission would result in:

The form submission ($form_state) being logged into watchdog or another log
Watchdog returns the associated event ID
The user sees a custom error page describing the error, with the event ID as an error code to help in debugging.

I can hack something together with die() and a hash of the form data as an error code, but is there a better, proper Drupal way?

Relevant code so far:

 try {
    $apiResponse = drupal_http_request($apiEndPoint, [
      'headers' => ['Content-Type' => 'application/json'],
      'method' => 'POST',
      'data' => drupal_json_encode($formData),
      'timeout' => 5 // Timeout in seconds.
    ]);

    // I'm not okay :(
    if ($apiResponse->code != "200") {
      throw new Exception ($apiResponse->data, $apiResponse->code);
    }
  } catch (Throwable $e) {
    watchdog('tfm_custom_form_handlers', "A custom form handler failed: (@code) @message.", [
      '@code' => $e->getCode(),
      '@message' => $e->getMessage(),
    ], WATCHDOG_ERROR);
  }

Thanks for the help!


texts: How to put page-title inside of my content's first panel?

texts:
Using a custom theme, pretty basic (so far):

    <?php if ($title): ?>

            <?php print $title; ?>

    <?php endif; ?>

    <?php if ($tabs): ?>

            <?php print render($tabs); ?>

    <?php endif; ?>

    <?php print render($page['content']) ?>

That standalone
 is the problem, though. I want it to appear inside the first panel of content (I'm using Panopoly), but since all the panels are generated by render($page['content']), it's not clear to me how I should do this.

My first solution was to use CSS, positioning the title relatively and adding some padding to the first panel to give it room. However, this only works as long as the title is one line of text. So a pure CSS solution appears to be out.


texts: Drush pm-disable needs a higher bootstrap level to run

texts:
I keep having this periodic issue with the pm-disable (amongst other) commands in Drush. I have kicked the tires on configuring Drush -- I have the datbase connect set to 127.0.0.1, have php.ini in the ~/.drush dir, using MAMP PHP -- same results.

drush status indicates that it connects without issue. My all directory has user and group level read and write, my site directory has read level on user and group (no write). Do I need to enable different chmod settings in my homesite dir or what am I missing?

This is the pm-disable output when it fails.

The drush command 'dis views' could not be executed.                                                                                [error]
Drush was not able to start (bootstrap) the Drupal database.                                                                                [error]
Hint: This may occur when Drush is trying to:
 * bootstrap a site that has not been installed or does not have a configured database. In this case you can select another site with a working database
setup by specifying the URI to use with the --uri parameter on the command line. See `drush topic docs-aliases` for details.
 * connect the database through a socket. The socket file may be wrong or the php-cli may have no access to it in a jailed shell. See
http://drupal.org/node/1428638 for details.

Drush was attempting to connect to:
 Drupal version         :  7.31
 Site URI               :  http://mywellbeing.local
 Database driver        :  mysql
 Database hostname      :  127.0.0.1
 Database port          :  8889
 Database username      :  mydrupalsite
 Database name          :  mydrupalsite
 PHP executable         :  /Applications/MAMP/bin/php/php5.5.14/bin/php
 PHP configuration      :  /Users/cameronkilgorew/.drush/php.ini /Users/cameronkilgorew/.drush/php.ini
 PHP OS                 :  Darwin
 Drush version          :  7.0-dev
 Drush temp directory   :  /tmp
 Drush configuration    :
 Drush alias files      :
 Drupal root            :  /Users/cameronkilgorew/mydrupalsite/repo
 Site path              :  sites/mydrupalsite.local


texts:
I'm really stuck on a problem that I'm seeking assistance on.
I have 3 categories under the same Taxonomy Vocab for a specific content type .

Taxonomy:
 - category 1
 - category 2
 - category 3

Now I need to make a view that when i click the link for category 1 it will show all content under that category . same as the other category . Im currently using D7.

I thank you much in advance for any assistance you can provide!

this is a follow up question ...

contextual filter saves me from this filter but when I try to access it in the url the layout of the page is not like the views ... it gets the views for the taxonomy


texts: Creating a block to show content in the same group of the current node

texts:
I would like to create a block that in node/x displays the links to all the nodes in the same group as x.
I created a view of Content, a relation of Group but no contextual filter allows me to filter by current node's parent group