texts: Why are KernelEvents not triggered on cached pages?

texts:
Why Kernal events not triggering on cached pages.I have tried using priorities..

$events[KernelEvents::REQUEST][] = ['onRequest', 27];

Services.yml file

tags:
  - { name: 'event_subscriber', priority: 210, responder: true}

MyEventsubscriber.php

    public static function getSubscribedEvents() {
    $events[KernelEvents::REQUEST][] = ['onRequest', 27];
    return $events;
   }

    public function onRequest(GetResponseEvent $event) {
    $response = $event->getRequest();
   \Drupal::logger('my_event_subscriber')->notice('Page Hit');
   }

It is not logging when the page is served from cache... Any other approach?


texts: How to solve these errors that appear while running update.php (during upgrade from Drupal 6 to 7)?

texts:
Can someone shed me some light regarding this error?

  The following updates returned messages

  taxonomy module

  Update #7007
  Failed: DatabaseSchemaObjectExistsException: Cannot add index name to table taxonomy_term_data: index already exists. in DatabaseSchema_mysql->addIndex() (line 432 of /var/www/vhosts/drupal7upgrade/includes/database/mysql/schema.inc).

  services module

  Update #7301
  Failed: DatabaseSchemaObjectExistsException: Cannot add field services_endpoint.debug: field already exists. in DatabaseSchema_mysql->addField() (line 323 of /var/www/vhosts/drupal7upgrade/includes/database/mysql/schema.inc).

  search module

  Update #7000
  Failed: DatabaseSchemaObjectExistsException: Cannot add primary key to table search_dataset: primary key already exists. in DatabaseSchema_mysql->addPrimaryKey() (line 392 of /var/www/vhosts/drupal7upgrade/includes/database/mysql/schema.inc).

I'm getting thes errors when attempting to run update.php while upgrading from Drupal 6 to Drupal 7.


texts: How to edit personal contact form e-mail content - Drupal 7

texts:
I looked everywhere in my admin for this. Can it be achieved via the admin panel or do I have to make a custom module?

I can't seem to find an adequate code snippet on Drupal Answers. Help would be greatly appreciated.


texts: Get parts of current page url for use in rules

texts:
I have the following setting:
A content type "Task" with fields:
term reference: unit name
integer: unitnumber
entity reference: here I am referencing an entity form type.

I have specified as patterns for the path from this content type:
[node:field_unitname]/[node:field-unitnumber]

When a user fills in the entity form on a certain node from this content type, this should create a blog entry, where the content for title and body field can be fetched from the entity form submissions, but the variables for the unitname and the unitnumber, which are fields in my blog content type as well, should be fetched from the current page url.

Therefore I have created a rule:
* Event: After saving a new entityform submission
* Condition: Entity has field: (1) Entity: [entityform], Field: field_title and (2) Entity: [entityform], Field: field_blogbodytext
* Action:
- Create a new entity. Parameter: Entity type: Node, Content type: Blog entry, Title: [entityform:field-title], Author: [site:current-user]
Provides variables: New Blog entry (blog_created)
- Set a data value. Parameter: Data: [blog-created:body], Value: [entityform:field-blogbodytext]

Now I also would like to set the data values for [blog-created:unitnumber] and [blog-created:unitname] which should be something like "first part of current page url" and "second part of current page url" as the current page url is my-website.com/unitname/unitnumber, but I have no idea where to find these variables in rules.

Could anyone help me out, how to get these values within rules?


texts: FlySystem problem, file can not be uploaded into directly that exists

texts:
I had created a question in order to config FlySystem module correctly for Drupal 8 to work with ftp.
you can see it here.
fortunately with @mbomb007 helps, I could do it.
but another problem happened and I don't know that is the reason.
problem is when flysystem module tries to upload a file into directory that exists, upload fails and in status message I see this error

The upload directory 2020-12 for the file field field_image could not
be created or is not accessible. A newly uploaded file could not be
saved in this directory as a consequence, and the upload was canceled

Imagine when module wants to upload a file into 2020-12 directory. if directory doesn't exist, it creates directory 2020-12 at first and then upload file into it. there is no problem till now.
but for the second upload, if module wants to crated another file into same directory 2020-12, upload fails.
I searched a lot into files and module issues page. I think problem is related to result of is_writable() function. this function returns FALSE for created directory that we want to upload file into it.
I checked FTP configuration on remote server. tried to set permission to 777 for all folders. but problem not solved.
I am searching more but I am not sure what exactly causes this error.


texts: Migration tries to create existing entity

texts:
I have a D8 migration where I pull remote resources and for each one I create new entity object, apply the resource onto the entity via custom methods on that entity and return the data for this resource as $entity->toArray(). This is how my iterator is getting build. So basically it is an array of entity definitions.

On the target entity I have a field called 'name' which is a unique fields so no two entities with the same 'name' can exist. In the migration I have this field as id key. But for some reason when I run the migration it tries to create a new entity and so the UniqueField constraint will prevent the entity to be saved(I am doing validation in entity's preSave() method) and my migration will fail.

And I cannot figure out why it won't match the existing entity if the 'name' field has a value(I have checked this on multiple places in the code).

The only thing I can come up with it so try to load an existing entity in the prepareRow() myself but that seems as very strange approach and I could basically just completely scratch the migration and write a simple batch.

This is my iterator:

  /**
   * {@inheritdoc}
   */
  protected function initializeIterator() {
    $items = $this->getResourceEntity()->getResourcePlugin()->loadAll();
    $storage = $this->entityManager->getStorage($this->getDerivativeId());

    $items = array_map(function($resource) use ($storage) {
      $entity = $storage->create();
      $entity->resourceMap($resource);
      return $entity->toArray();
    }, $items);

    return new \ArrayIterator($items);
  }

After debugging \Drupal\migrate\Plugin\migrate\id_map\Sql::sourceIdFields and \Drupal\migrate\Plugin\migrate\id_map\Sql::destinationIdFields it looks like it tries to map 'name' => 'id' fields for some reason instead of 'name' => 'name'.

I guess that is because the destination plugin(content entity) returns the entity id field which in this case is id in \Drupal\migrate\Plugin\migrate\destination\EntityContentBase::getIds.

I guess I am missing some crucial information here on how the migrations work.

So yeah, I had to use 'id' in getIds(), and in the iterator I had to try to figure out entity id of an existing entity.


texts: How can I create a view that lists users who have NOT completed an order?

texts:
I am helping with a Drupal 6 / Ubercart site that has tons of spam user accounts registered.

I want to create a view that will list spam accounts. My thinking is that users who have registered but never bought anything in Ubercart have a high probability of being spam so I want to create this view. However, I can't figure out how to filter my user view to list only users who have not completed an order.

Is this possible?


texts: Restricted access url for an image uploaded to private filesystem

texts:
I have a custom content type with an image and a file field, both of which are uploaded to the private file system.

How do I create a public url to the image that will check for user permissions so that anonymous users are prevented from being able to browse to the image?

This is the code I tried first:

$url = file_create_url($node->field_my_private_image[$node->language][0]['uri']);

It generates a url to system/files/ but that url is visible to anonymous users and it isn't being restricted by user permissions.

I saw a security patch for drupal 7.13, but it was supposedly fixed and I'm using drupal 7.22.

Is there a built-in way to do this or do I need to implement some functions in my module to respond to special urls to access these files which will check permissions and then stream the file back to the browser?


texts: Can't get rid(find) of this margin. Please help!

texts:
I isntalled the Professional theme and Content Glider - all very simple. I got rid of titles and all in the glider, but I can't find the code where the blank line or margin is created. Drupal is new for me. Look and you'll see right away: http://www.aironfix.eu
The slider content-type has no body just title and image. Please help.


texts: Field values sometimes do not show up in grid view or node view for non admin users

texts:
I have a view that is sorted by the number of times a user visits a node and clicks the play button (the play button is a menu item of the node).  Every time the play button has pressed the value of an integer field inside the node is incremented and this value is used to sort my view.  I also display the value "Times Played" both in the view and the node.  When I look at the view as admin everything looks good, like this:

But when I look at the view as a normal user the view is still sorted correctly but some of the nodes don't show the value for "Times Played", here is that screenshot:

Also, when I view the actual node page as an admin I see always see the correct value for "Times Played" but when I visited it as a normal user I get the same behavior I see in the view.  Any idea what could be going on here?  Is this some strange permissions issue?


texts: I have muliple webforms in my site, but want to disable all webforms after user makes a submission

texts:
I'm stuck. I have a site that has many users. Each user is allowed to log in and has access to a certain number of webforms (depending on their role status). Each webform contains a product that they receive for yearly award. They can pick from any of the products/forms that their user role allows.

The problem lies when they submit the form/product that they would like, the other forms are still active, which would allow them to submit another form etc etc.

I need to deactivate ALL webforms for that user when they submit their form/product choice so they cannot submit multiple products from the same user.

Please help.

B


texts: Include error (entity.inc) on multi site installation

texts:
I'm on a server where Drupal 7 was installed using the package manager. (Debian)

So the codebase is at /usr/share/drupal7/ with the sites folder symlinking to /etc/drupal/7/sites

Let's assume the URL to our homepage is www.foo.com and we have two sites using the same codebase. So we have:

www.foo.com/site1
www.foo.com/site2

/etc/drupal/7/sites/foo.com.site1
/etc/drupal/7/sites/foo.com.site2

also at /etc/drupal/7 we have a apache.conf doing:

Alias /site1 /usr/share/drupal7
Alias /site2 /usr/share/drupal7

<Directory /usr/share/drupal7/>
        Options +FollowSymLinks
        AllowOverride All
        order allow,deny
        allow from all
</Directory>

It actually works nice. I can install sites and edit content and whatever. But now I wanted to copy a site from another server (Ubuntu - also package manager installation, so same "setup"). So I rsynced it and edited settings.php. [actually there's only the database info to update].
I then exported and imported the database and emptied all cache tables.

Let's say we copied the site to site1. If I go to www.foo.com/site1 I get:

PHP Fatal error:  require_once(): Failed opening required '/usr/share/drupal7/sites/default/modules/entity/includes/entity.inc' (include_path='.:/usr/share/php:/usr/share/pear') in /usr/share/drupal7/includes/bootstrap.inc on line 3190

The code here is:

if ($file) {
  require_once DRUPAL_ROOT . '/' . $file;
  return TRUE;
}
else {
  return FALSE;
}

with DRUPAL_ROOT . '/' . $file being /usr/share/drupal7/includes/entity.inc

DRUPAL_ROOT is set in index.php, which is located at /usr/share/drupal7/index.php. So I get the above strange file path.

Question 1: Why does the error say can't include /usr/share/drupal7/sites/default/modules/entity/includes/entity.inc although it actually should look for /usr/share/drupal7/includes/entity.inc? Does Drupal have some fallback mechanics here?

Question 2: How can I make the file paths correct? I think it shouldn't look for the file in /default but in /site1 or /site2 - according to which site I'm accessing.

Edit: the registry database is full of paths including /default - how can I rebuld it? (it was the default site on the old server)


texts:
I'm using Boost and Drupal internal cache on two different websites and i m remarking that the site with internal cache is more quickly than the site with the Boost module .
So I'm asking which between the two methodes are suitable ?
Thank  you very much


texts: Change Entityqueue autocomplete to an entity widget

texts:
I have an Entityqueue and whenever a user wants to add an item to queue, he/she should write part of title in Autocomplete to add it to queue.

I want to change this autocomplete with a widget that list entities with pagination and when user clicks on an Entity title to add it to queue.


texts: Is there any way to reset a menu's default order (e.g. Management Menu)?

texts:
I have installed Drupal Commerce Kickstart and included with the distro is a mega menu. It also restructures the menu items to a more "End-user friendly" order. I personally prefer the default order that core gives you. Is there any way of resetting the "Management menu" to it's default order (without manually reordering them again)?

This is what it looks like after disabling the mega menu and enabling good ol admin_menu


texts: drupal_mail() sends two emails, second email is empty

texts:
I'm using the following code for sending out an email with drupal_mail()

$module = 'example_module';
$key = 'key';
$language = language_default();
$params = array();
$from = 'email@email.com';
$send = TRUE;
$message = drupal_mail($module, $key, $order->mail, $language, $params, $from, $send);
$message['subject'] = 'Subject';
$message['body'] = $message_body;

// Retrieve the responsible implementation for this message.
$system = drupal_mail_system($module, $key);
// Format the message body.
$message = $system->format($message);
// Send e-mail.
$message['result'] = $system->mail($message);

I get two emails after the function that contains this runs, one email is perfect, the other email is completely empty.

The function that contains the code above only runs once, I tested by printing out some text with dsm().

How can I fix this?

Thank you!


texts: How to print id of user whose profile I visit rather than id of  logged in user?

texts: I would like to print the id of the user on his profile page? How can I do it in Drupal 7. So far I could only print logged in user id..Any advice appreciated.


texts: Adding a tab to commons browsing widget with hook_commons_bw_group_widget()

texts: I am trying to add a tab to the Commons Browsing Widget so I made a custom module and followed this guide https://drupal.org/node/1782922. I used the first PHP code with hook_commons_bw_group_widget() but it doesn't add the new tab to the widget. What could be wrong?


texts: Need to disable Auto Preview in views for local development in settings.php

texts:
Can I add a setting in settings.php to disable Auto Preview in views. I know this can be changed under /views/settings/. But I don't want this configuration added to Git. I only want this change on my local site. Something like this.

$config['system??']['foo']['bar'] = FALSE;

I unchecked 'Automatically update preview on changes' in Views settings and exported the changes. The result is that it updated  'views.settings' Below is part of views.settings.yml

     ui:
      show:
        additional_queries: false
        advanced_column: true
        master_display: true
        performance_statistics: false
        preview_information: true
        sql_query:
          enabled: true
          where: below
        display_embed: false
      always_live_preview: false
      exposed_filter_any_label: old_any

The setting may look something like this.

$config['views.settings']['ui']['always_live_preview'] = FALSE;


texts:
Maybe I'm asking the wrong questions on google, but I can't seem to find a solution to what I'm trying to accomplish.

We've created a Drupal 8 site and we need to add the existing header and footer to an external site so that it includes our site branding.

What is the best solution to accomplish this?

I have some initial thoughts, but feel like I'm way off base:

Pull the <header> and <footer> out of the page.html.twig template and put them into a separate header.html.twig and footer.html.twig template. (My base theme is bootstrap barrio)
Create a custom API that exposes the html from the header and footer twig templates. (I'm not sure if this even possible)
Using the custom API, expose any paths to custom CSS/JS required for theming.

Then the external website would just call the API, grab the html/css/js and put all the gathered resources on their pages.

Is the above on the right track or am I completely wrong? If I am on the right track, how would I accomplish #2?


texts:
I have a website that has users with role "sellers".
The website has a nodes/stores that belongs to the sellers.

So let's say I have 3 users and 10 nodes for their objects. The names will be fictive, just to explain better this specific task.

Users with role "sellers":

John
Mark
Cindy

Nodes/stores

John's store 1
John's store 2
John's store 3
Mark's store 1
Mark's store 2
Mark's store 3
Mark's store 4
Cindy's store 1
Cindy's store 2
Cindy's store 3

Every seller will be able to login into the website and see his/her stores, but cannot create or edit a node/store. Only admin will do that. When creating these stores the admin will make author by the user name. For an example:

John's three stores nodes will have author as John, so the seller John when log into his user pages, will be able to see his stores. That's ok and already accomplished.

When John's wants to make some new offers will send a form that will be sent to the admin. The specific thing is, John will be able to select a drop down list with his stores (in this case 3) and select what stores will have this new offer, so on sending the email, the admin will know for which stores is the new offer.

How can I create this kind of drop down select list based on author id?

I have acknowledge with custom modules and lot's of hooks, so creating a custom form wont be difficult.


texts: It doesn't work without public_html symlink

texts:
I have just updated to Ubuntu 20.04 so have a fresh install of everything.
I have a working Drupal 7 site I'll call mysite.
I have Drush-launcher installed globally at /usr/local/bin/drush
The file structure of the site is the following.

/var/www/mysite/composer.json (to install Drush 8.4.1)
/var/www/mysite/vendor/drush/drush/drush (local Drush 8.4.1 binary)
/var/www/mysite/web
/var/www/mysite/public_html (symlink to web)
/var/www/mysite/web/sites

Drush works with this configuration. drush status returns a full and accurate site description of about 15 lines.
If I remove the public_html link, the Drupal site runs fine but most Drush commands no longer work. drush status returns only the bare minimum of 7 lines as it does when it can't find the site. drush --version does return the correct version number either way and if I move the Drush 8 directory, all Drush commands return an error as expected. (This shows I'm still using the correct binary).
I have several Drupal 8 sites that are configured this exact same way (no public_html directory or link) and they work as expected.
I have searched in the ~/.drush directory for any reference to public_html and there are none related to this site. I have cleared the Drush cache. There are no references to public_html in my Apache config for the site. Searching isn't turning up anything useful.
I could just leave the public_html link in the filesystem but git wants me to add it or ignore which seems kinda silly.
What might I be doing wrong?


texts: How to customize the text of "SUBMITTED BY" (article)

texts:
I like to customize the output of SUBMITTED BY, e.g. I like to change it to WRITTEN BY.
Where can I do it? Thanks for help


texts:
Say I have a content type "task" with one field "status", which is output by views. Now I want when the status is "finished", the color of that row will be red, when the status is "failed", the color of that row will be yellow, when the status is "ongoing", the color of that row will be green.
Is there any way to realize this? BTW, I know very little about code.


texts: How do I get the server time using REST GET HTTP?

texts:
Is it possible to get the time from Drupal 8 with GET HTTP and REST?

I get the date format from /entity/date_format/long, which returns a value similar to the following one.

{
"uuid": "76e070cb-a783-47bf-89cc-db9f393a7d59",
"langcode": "en",
"status": true,
"dependencies": [],
"id": "long",
"label": "Default long date",
"locked": false,
"pattern": "l, F j, Y - H:i"

}

It is not what I need. I need to get the server time, so I can after synchronize some dates.


texts: Add product information with variation in cart

texts:
I sell product which actually are product variation.
In the cart or the checkout , all I can see are products variation information ( size price etc..) In this view I need to see the product, with the title, image, ...

Are there any solution for that ?

Thank you.


texts: How to use context module instead of panel module?

texts:
I am unable to set user permission on particular section of panel. For example I have used 3 column  panel layout for particular page and want to set view permission to only one column out of three to particular set of people. But I didn't found any settings for the same in panels. So I tried with context module but I do not have much information on context module and how it works for page layout and permission.
Can anyone help me in that?

Thanks in advance.


texts:
I'm getting url alias for all articles like mysite.com/node/14 but I wanted to set the url as aritcle titles like this: mysite.com/article-title

So, How to set all url alias as per the articles title?


texts: Fetching Views 3 implementation from code

texts: I am using Drupal 7. What I want to do is to fetch the View 3 implementation from code, rather than from database, so that I can export my view, and put it in a function that would be available to all my team members w/o the need of importing the database script.


texts: Can solr point into a certain point in a document?

texts: I have very long documents (around 100 pages when printed) that I need to index with Apache Solr Search. Is it possible to index the pages with solr in such a way that clicking the result from the result page takes the user into the right document and into the right place in the document?


texts: hide if on front page and on taxonomy pages

texts:
i wondering how i can hide $title if its on the front page and on taxonomy pages, I only want it to show on nodes.

here my code, I dont know if im close or not =)

function bartik_process_html($variables){
    if(!drupal_is_taxonomy()){
    $variables['title']['class'][] = 'element invisible';
    }
    elseif(!drupal_is_front_page()){
    $variables['title']['class'][] = 'element invisible';
    }
    else{

    }
}


texts:
I have a table listing that shows the Item # and a View/Print/Download link to open a PDF datasheet in a new tab.  Right now I have like 3 or 4 in the system but in time I will have like 700-800 of them and the columns take up less than half the width of the page and although I have been looking I can't find a way to create two columns

I don't care whether the data goes

CH098 View     CH099 View
CH100 View     CH101 View
CH102 View     CH103 View

or

CH098 View     CH101 View
CH099 View     CH102 View
CH100 View     CH103 View

Does anyone know if there is a module for views that I missed that can do this?


texts: Where is the CCK autocomplete widget field php configuration code stored?

texts:
I have run myself into a serious problem. I have a custom CCK datatype in Drupal6 in combination with an autocomplete widget on a text field. I have defined php code in the web configuration for the "allowed values list", but the code I wrote is faulty and uses up all memory (three nested foreach loops, returned array gets way too large, 2G mem limit reached).

Unfortunately, I cannot access the Drupal6 instance at all, as it seems the faulty php code is executed on all pages (not sure about this, but did reboot the server and still could not log in).

I guess it would be best just to delete the faulty PHP code for the Autocomplete widget from the backend, but I am unable to find it in the Postgres database. Can anyone give me a hint as to where in the database this code is stored?

Any other hint as to how to resolve this problem will be highly appreciated.


texts: remove theme tab on blocks for certain roles

texts:
I'd like to hide/remove theme block tabs for certain roles in drupal.
For example Administrator can edit both theme blocks, but other roles can edit only blocks that are available in their current theme.

Picture:

As you can see on picture, I'd like to hide SEVEN from other roles that are not Administrator ? Any ideas.

Thanks!


texts: When an anonymous user hits '/user/login' route, how can I trigger an event?

texts:
I want to trigger an event when an anonymous user comes to /user/login. I made an event subscriber, but it only fires one time:

namespace Drupal\mymodule\EventSubscriber;

use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Drupal\Core\Routing\TrustedRedirectResponse;

/**
 * Class LoginSubscriber.
 *
 * @package Drupal\mymodule\EventSubscriber
 */
class LoginSubscriber implements EventSubscriberInterface {

  /**
   * Redirect the user before we let them access a login form.
   */
  public function onLoginRequest(GetResponseEvent $event) {
    $account= \Drupal::currentUser();

    $config = \Drupal::config('mymodule.settings');
    $base_url = \Drupal::request()->getSchemeAndHttpHost();
    $site_key = $config->get('eweb_site_key');

    switch ($config->get('mode')) {
      case 'test':
        $url = $config->get('eweb_base_test');
        break;

      case 'live':
        $url = $config->get('eweb_base_live');
        break;

      default:
        $url = $config->get('eweb_base_test');
        break;
    }

    // User is accessing login page, check for active session
    if ($event->getRequest()->getRequestUri() == '/user/login' && $account->isAnonymous() && $event->getRequest()->query->get('loginFailed') == FALSE) {
      $response = new TrustedRedirectResponse($url . '/StartPage.aspx?Site=' . $site_key . '&URL_success=' . $base_url . '/user/netforum/{token}&URL_failed=' . $base_url . '/user/login?loginFailed=true');
      return $response->send();
    }
  }

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    $events[KernelEvents::REQUEST][] = ['onLoginRequest'];
    return $events;
  }
}

The purpose is that the external site will look to see if this user has an active session, if so, it will redirect back to my site with a token and that controller will handle logging in that user with some logic and user_login_finalize.

However, it is currently only firing once.


texts: How can I replace all my internal links automatically?

texts:
I have changed the domain of my website from www.mysite.com to mysite.net. I upload the site to the new domain and all is fine, but I have more than one thousand nodes, and in almost all the nodes I have a link to another node on the site.

The link are absolute so they have this form: www.mysite.com/node/22 and I need to change all nodes to the new domain.

Changing 1,000 links manually is too much. How can I do this automatically??


texts: Invalid Argument Exception when saving a view using a custom filter handler

texts:
I am working on a project which implements a custom views filter; more specifically based on the InOperator class.

I have been following the guide below to implement the custom filter:
Creating a custom Views filter in Drupal 8 and the repo used in that guide may be obtained here:
Accompanying GitHub repo

Everything works with both my custom filter, and the filter provided in the referenced guide whilst inspecting in the views preview, however when the view is saved, the website crashes with the following error:

InvalidArgumentException: The configuration property display.default.display_options.filters.node_titles.value.my_title doesn't exist. in Drupal\Core\Config\Schema\ArrayElement->get() (line 74 of core/lib/Drupal/Core/Config/Schema/ArrayElement.php)

Any advice on how to fix this or if there are any steps that have been missed out would be greatly appreciated; even if a link could be provided to more recent documentation as I have not found much on this subject other than reading through the base classes.  Even then I cannot find any reference to the error which is displayed.

To reproduce

Download the module in the linked repo and enable on a D8 site.
Create a view of nodes.
Add the 'Node titles' filter and select an option.
Save the view.

Many thanks in advance.


texts:
I'm trying to attach a JS library to a render array for a field formatter.

I'm using

  $element[$delta] = array(
    '#theme' => 'image',
    '#prefix' => "",
    '#suffix' => "",
    '#path' => $initial_path,
    '#alt' => $item['alt'],
    '#attached' => array(
      'libraries_load' => array(
        array('fluidbox'),
        ),
      'js' => array(
        drupal_get_path('module', 'fluidbox') . '/js/drupal_fluidbox.js',
        ),
      ),
    );

But the library doesn't seem to load. Any suggestions? It works if I put libraries_load into a preprocess function.


texts: How do I pre-configure default blocks for my drupal 7 theme

texts:
I'm open-sourcing a custom drupal theme, and I'm looking to provide a good out-of-the-box experience to those who use it. However, when the theme is enabled for the first time, many of the default drupal blocks (search, user login, "powered by drupal," etc.) are all jammed in the first block-region (pre-header), which pushes everything down and makes the page look broken.

I'd like to do one of the following things:

Unassign all blocks by default for the theme, to give users a
clean slate
Pre-position the blocks into more appropriate regions

I don't want to do it in an install profile or a module, to keep things simple for end-users. Any ideas?


texts: How do I output a category and its custom field on a node listing?

texts:
We've got a content type that has a Category field. The Category taxonomy has a tagline (custom field). I also have a view (Page type) that outputs all nodes of my content type, grouped by the category. So the output is sort-of like:

Category

Node
Node

Category

Node
...

But I'd like to display the category with its tagline (a custom field), like:

Category - Tagline

Node
Node

Category - Tagline

Node
...

But I can't figure out how to do this. I've been trying to use Rewrite Results to customize my resultant markup, but the tagline content isn't available as a token, nor is the description. According to the Rewrite Results' Replacement panel, only the formatter-based output and term ID are available.

What is the correct way to display the category's tagline, preferably using Rewrite Results?


texts: Is there a way to get a value of a multi value field of an entity reference (reference a field value of a referenced term)?

texts: I hope that maybe someone had a similar use case and has an idea how to solve it: I have content type that has an entity reference field to a vocabulary. With that I would like to achieve it to not only reference to the term itself in the manage display (in my case a country name), but also choose a certain value of a multiple value field of that term (one of the several historic names of that country). I created a hack with an additional list field in the content type (choose historic name 1, 2, 3...), but this is no good solution because as soon as I modify the order of the field items (e.g. because of adding one), the name is displayed wrongly all over the website. So there is the need to directly reference the field value of the referenced term itself.


texts:
I am trying to get flag "purchase" and flag it for an user while completing an order in Rules (Commerce). This is how it goes in a PHP code:

$flag = flag_get_flag('purchase');
$nid = $_SERVER ['REQUEST_URI'];
$nid = explode("node/", $nid);
$node = node_load($nid[1]);
global $user;
$flag->flag('purchase', $node->nid, user_load($user->uid), TRUE);

Does anybody see any inaccuracy in what I've done? I just don't know why it is not working.

This is the error I am getting (actually it says nothing to me):

  Notice: Undefined offset: 1 in eval() (line 4 of C:\xampp\htdocs\mysite\sites\all\modules\rules\modules\php.eval.inc(146) : eval()'d code).
  Notice: Trying to get property of non-object in eval() (line 6 of C:\xampp\htdocs\mysite\sites\all\modules\rules\modules\php.eval.inc(146) : eval()'d code).
  Notice: Trying to get property of non-object in flag_entity->applies_to_entity() (line 130 of C:\xampp\htdocs\mysite\sites\all\modules\flag\includes\flag\flag_entity.inc).


texts: Fresh install of COD: Anonymous users get "Access denied" on homepage

texts:
Problem

I created a clean VM & installed COD. Unfortunately, when people aren't logged in they see:

How should I go about diagnosing further and/or resolving this issue?

Things tried

I thought this might be because the first conference wasn't published but the published flag was set, and I ticked the 'Promoted to front page' option.
That did not resolve the issue, so I created a basic page and applied the same options. No change to the homepage.
The homepage was set to node/1 so I changed it to no extension so that it could use the default homepage. No change.
UPDATE: Ticked Grant content access and Grant own content access for anonymous users in admin/people/permissions
UPDATE: Tried to use the rebuild option (/admin/reports/status/rebuild) to no avail


texts:
I have a custom content type with file field as one of the fields. For theming/UI purposes I should make this file field as clickable button. And only when user clicks on it, he/she gets modal window with upload/file browse or file name if there already is a file uploaded.

I've accomplished this with using jQuery Update module and from there with help of jQurey UI Dialog (https://jqueryui.com/dialog/) and custom module with JS code:

(function ($) {
Drupal.behaviors.module_custom = {
attach: function (context, settings) {
//appending button
var $inputButton = $('<input type="button" value="Līgums" id="open_modal" />');
$inputButton.insertAfter($(".field-name-field-file"));
//hiding file upload wrapper div
$('.field-name-field-file').hide();

//initializing modal dialog window
$( ".field-name-field-file" ).dialog({
  autoOpen: false,
  show: {
    effect: "blind",
    duration: 1000
  },
  hide: {
    effect: "explode",
    duration: 1000
  },
  width: 500
});

//launching modal dialog when button is clicked
$( "#open_modal" ).click(function() {
  $( ".field-name-field-file" ).dialog( "open" );
});

  });

}
  };
    }(jQuery));

This all works from UI/theming perspective but it brakes file upload. When modal window opens and file is uploaded I got error "An unrecoverable error occurred. The uploaded file likely exceeded the maximum file size (8 MB) that this server supports." no matter how small file is (event if it is 1 KB). I suppose this issue is related how AJAX upload is handled. Any ideas what is issue here?


texts: Create content types containing other content-types

texts:
I've created a custom content-type called "Books."

I need to create another content type named "Catalogs" which may contain one/many "Books" as its fields.

How would I achieve that? I'd prefer some GUI tool to construct my custom content type, from admin panel, or doing some coding, if necessary.

PS: I found this question asked here but the solution did not help. Can someone provide a detailed answer, please?

EDIT:

MohammadAliAkbari's answer works perfectly :) One problem - When adding "Books" a user can add Books not created by him - he can add any Book to his "Catalog" - How can I add constraints such that a user can add Books only created by him to his Catalog?

Solution:

Using Tenken's answer, I figured out that I can write this code in my module to solve the scenario just mentioned above:

function myModule_form_alter(&$form, &$form_state, $form_id) {
//    dsm($form_id); // Use this line to find YOUR-DESIRED-FORM-ID
    switch ($form_id) {
        case 'YOUR-DESIRED-FORM-ID':
            $form['#validate'][] = 'stylesku_add_sku_form_validate';
//            dsm($form); // Use this to find out form's elements
            global $user;
            $currentUser = $user->uid;
            $fieldSku = $form['FIELD-ID-OF-BOOK'];
            $lang = $fieldSku['#language'];
            $fieldOptions = $fieldSku[$lang]['#options'];
            foreach($fieldOptions as $nid=>$nodeTitle){
                if(!is_int($nid))
                    continue; // Needed as the first option in select box is not really any book
                $nid = (int) $nid;
                $n = node_load($nid);
                if($n->uid != $currentUser){
                    // Remove this BOOK, this book was not created by current user
                    unset($form['FIELD-ID-OF-BOOK'][$lang]['#options'][$nid]);
                }
            }
            break;
    }
}


texts:
I am recreating an existing website and part of the process is enabling a theme from the same existing site on my new version.
The theme is called microsite and has an image located in /microsite/images/.
In the original site, the image from the above directory is loaded and displayed in a block.
I copied the code from the block of the original site, pasted and saved in a block of my new site. The HTML markup is the following.

Using the exact HTML markup in my recreated site with the same theme and path to image shows a broken image link. The link shows up as    http://192.10.10.1/sites/all/themes/microsite/images/image.jpg instead of
http://192.10.10.1/mysite/sites/all/themes/microsite/images/image.jpg.
To resolve this, I set $base_url in settings.php to http://192.10.10.1/mysite, but the link is still broken.
Can anyone help, please?


texts: In Views, how can I use the rewrite text to include an image in HTML with some text and then translate the text?

texts:
I've installed Views along with the Internationalization views module.  I have a view of users.  The users have some single-value boolean fields in their profiles.  I would like to rewrite the results of these fields so that if they are true an image and some text is shown.

Example: If "likes_soccer field is true, then show an image of a soccer ball with the words "Loves soccer"

This is quite simple to do in Views.

However, I also need to translate the text, and this is where I'm running into problems.  Internationalization Views allows the text to be translated, but because it is HTML it ends up being sanitized so that the IMG tag is displayed as code rather than interpreted as HTML (as this answer explains).  I can simply ignore the IMG tag in my translation, which will allow me to translate the text, but then I will lose the image in the translation.

Is there an alternative way to do this?


texts: Having problems with Backup migrate and file system for custom back up settings

texts:
I am trying to set up backup migrate but keep getting this error with my custom destinations:

The specified file C:\source\sites\defaut\files\tmp\bacE255.tmp.mysql.gz.info could not be copied, because the destination directory is not properly configured. This may be caused by a problem with file or directory permissions. More information is available in the system log.

On this       URL:admin/config/system/backup_migrate/settings/destination/edit/backups_bruno

Settings

Destination name:
Backups_Bruno

Directory path:
/sites/default/files/backups_bruno

On this URL:
admin/config/media/file-system

Settings

Public file system path:sites/default/files

Private file system path:sites/default/files/private

Temporary directory:sites/default/files/tmp


texts: Remove one item in cart removes all - Ubercart/Webform

texts:
I'm using:

Drupal: 7-4.1
Webform: 7.x-4.12
Ubercart/webform intg: 7.x-3.0
Ubercart: 7.x-3.8

I am using this wonderful Webform module to add products to cart, all works ok, however, when added more that one item to the cart using multiple webform submissions then When I try to remove one item from the cart it says:

  If you remove this product from your cart, all products associated
  with your form submission will also be removed. Are you sure you want
  to delete this product?

So my question is; is there a way to remove one single item from the cart without removing all?


texts: Can I add custom fields to a single page?

texts:
Sorry for another "In Wordpress..." question but here we go...

In Wordpress, I can use ACF to add custom fields to a single page. This is done either in code or in the GUI by basically doing something like (pseudocode),

if id = 123
  add_field "Phone Number"
end

This is especially useful on homepages or landing pages where the layout is unique and I want to provide structured data entry without needing to create a custom type that is only used once. In Drupal, I dont see a way to dynamically add fields to an arbitrary piece of content. Is this possible? How?

Wordpress custom fields:


texts: Different placement/alignment for image (field) in teaser and Full content view

texts:
i have created a content type 'Article' which has a image field.
Both the teaser and Full view use the image field.(Default Drupal views for content)
Now the problem is this image field has the same CSS class.
So both the teaser view and full view get the same properties.
But i want the image in teaser view to align/float to left of teaser content, but to show in the top center region in the full view.
Since the CSS class is same for both view i can not achieve my goal ( point 5)

So please suggest me a way to achieve  point 5 without creating a new home page view in 'Views'


texts: How do I add image captions using a custom style?

texts:
I am not a programmer.

However, I need to know how to use css to add a caption for an image field in a node.


texts: how to restrict access in routing.yml based on roles

texts:
I know how I to restrict access in the routing.yml file based on permissions, but how can I do it based on roles? This is how to do it by permissions:

requirements:
  _permission: 'access administration pages'

How to do it based on roles?


texts: How to check if file has changed during (hook) form_validate in a form?

texts:
I have a custom content type, and the relative form for creating/editing contents. It contains a file field. I need to check, during hook

 function mymodule_myform_form_validate($form, $form_state){...}

if the user changed the file with another (while editing the content). This can be done by checking if the fid has changed, and the fid of the new file can be found, for example, in

 $lang_field = $form['my_field']['#language'];
 $file_fid = $form_state['input']['my_field'][$lang_field][0];

but what about the fid of the old file? Exploring form and form_state array i found several occurrences of the old and the new fid, but i am not sure which i'm supposed to use. I am not even certain that the code above is the correct one for retrieving the fid of the new file... There is a standard (safe) way to retrieve these informations?


texts: I am using D7.12 with webform 3.18. I want to change the image extension from png to jpg of the image uploaded through the form before saving it to database. I tried mytheme_webform_submission_presave() in template.php but didn't help me. How can I do this?


texts: Some of my pictures and fonts are not loading after uploading to host

texts:
I've just uploaded my website to my host.  There was a 500 Internal Server Error at first, I looked into my htaccess file and after a lot of struggling with it I commented this line: Options +FollowSymLinks and then it worked but still some of my pictures and fonts are not loading, also I have some errors in my pages like:

Warning: ini_set() has been disabled for security reasons in drupal_environment_initialize() (line 702 of /home/simamedi/public_html/includes/bootstrap.inc

and

Warning: ini_set() has been disabled for security reasons in include_once() (line 290 of /home/simamedi/public_html/sites/default/settings.php

Sorry, I'm quite new with these things, there's a live version of my website at www.simamedia.com.


texts:
I have a Drupal 8 site with a content type called Landing Page.  I'm using the bootstrap theme and I have the block showing the brand info (including site slogan) in the navbar.

I want some of the landing pages to have a different site slogan (shown in the navbar).  How can I do that?

What I tried

I thought of adding a text field custom site slogan to my Landing Page content type and then using a twig template (content type node template) to show the slogan, but the slogan is printed in the header, and the template comes after that.

I could also make a different branding block for each page I need to change the slogan on and manually change the text in a twig template, but that seems like a very horrible, labor intensive way to do it.


texts: Redirecting Drupal multisite non-www to www with varnish / nginx

texts:
I'm building Drupal multisite with 35 sites (~60 different domains) and I'd like to redirect non-www urls to www regardless of domain.

Nginx is redirecting all domains to Drupal install folder.

I've tried to redirect domains with Nginx without success (is that even possible because of varnish?)

I was able to redirect single domain with Varnish (something like "if domain == xxx then redirect to www.domain.tld"), but I don't want to make own redirect rule for every domain.


texts: Integrating the Webform module in a page

texts:
I want to have a form that will take end user inputs (text, sentence, text of multiple values and an image upload of png or jpeg format).

These inputs would be later stored in database and would be retrieved using views mysql module and displayed in webpage.

I tried to integrate the Webform module in my page, but it didn't work well with images while displaying through a view. It displays numbers instead of images (actually this is the place where I am facing issues).

Is there any ways that I can fix this, or do I need to build a module from scratch?


texts: How to trigger ajax Form API action by js

texts:
In a custom form you can add an #ajax property, e.g.

$form['some_element'] = [
    '#type'  => 'textfield',
    '#title' => 'Foo',
    '#ajax'  => [ 'callback' => 'foo_callback',
                  'wrapper'  => 'some_dom_id' ],
];

On this element, drupal will attach a behaviour to some_element's blur event. The behaviour submits the whole form, captures the response and uses it to replace the contents of some_dom_id.

I'm making a custom form element type and at a certain point (determined by non-Drupal js) I want to perform a Drupal AJAX update to the form without submitting it, just replacing a certain element; i.e. I want the 'normal' drupal behaviour, except I can't use the #ajax key to fire it.

What js should I run to do a Drupal ajax-submit-form?

I've tried attaching #ajax directly onto my custom element

So I've tried adding the #ajax bit onto my form element in element_info, but this does not attach the behaviour to my custom form element. I didn't think it would - can't really see how Drupal would know how to. Perhaps there's a way I can implement this on my custom element?

Adding #pre_render => [ 'ajax_pre_render_element' ] to my hook_element_info seems to add the ajax behaviour, but I don't get the whole form submitted (just a long list of ajax_html_id[] entries and page state lists of css,js files and the theme token and the submitting element; the other inputs are not included?

I've tried using a second 'normal' form element and hiding it

Yes this works, but it's a mess. Be a bit less messy if I could figure out how to add form elements within a custom form element implementation but that would be another question.

EDIT

I can't remember the details of why I asked this question now! But reviewing it threw up How to trigger Ajax forms machinery which seemed to have the key info needed to get around this problem.


texts: How do I programmatically install a module?

texts:
For Drupal 7, I found How do I programmatically install and enable a module?

What is the equivalent code for Drupal 8?

UPD: here Configuration Manager or hook_update() to enable modules I found the case when you can use the code during deployments, specially when your module has updates in own dependencies.


texts:
I'm trying to create a field with an additional property (or column) to define an extra relationship to a taxonomy term.

I have this in my module file:

/**
 * Implements hook_field_info().
 */
function emtr_field_info() {
    return array(
        // We name our field as the associative name of the array.
        'field_emtr_denominations' => array(
            'label' => t('Denominations'),
            'description' => t('Field linked to target entity as well as denomination taxonomy term holding denomnation value.'),
            'default_widget' => 'number',
            'default_formatter' => 'number_decimal',
        ),
    );
}

And this in my install file:

/**
 * Implements hook_field_schema().
 */
function emtr_field_schema($field) {
    $columns = array(
        'denomination_value' => array(
            'type' => 'int',
            'not null' => FALSE,
        ),
        'denomination_tid' => array(
            'type' => 'int',
            'not null' => TRUE,
            'default' => 0,
        ),
    );
    $indexes = array(
        'denomination_tid' => array('denomination_tid'),
    );
    return array(
        'columns' => $columns,
        'indexes' => $indexes,
    );
}

/**
 * Implements hook_enable().
 */
function emtr_enable() {

    field_cache_clear();
    field_associate_fields('emtr');

    if (field_info_field('emtr_denominations')) return;

    // Create a field for denominations to be used by safe checks and till reads
    $field = array(
        'field_name' => 'emtr_denominations',
        'type' => 'field_emtr_denominations',
        'cardinality' => FIELD_CARDINALITY_UNLIMITED,
        'translatable' => FALSE,
    );
    field_create_field($field);

    // Attach the emtr_denominations reference field to safe checks instance
    $instance = array(
        'field_name' => 'emtr_denominations',
        'entity_type' => 'emtr_safe_check',
        'bundle' => 'emtr_safe_check',
        'label' => 'Denominations',
        'required' => false,
        'widget' => array(
            'type' => 'number'
        ),
        'settings' => array(
            'target_type' => 'emtr_safe_check',
            'handler_settings' => array('target_bundles' => NULL),
        ),
        'display' => array(
            'default' => array('label' => 'inline', 'type' => 'number_integer'),
        ),
    );
    field_create_instance($instance);
}

But after uninstalling and re-enabling my module (drush devel-reinstall emtr -y
) a table called field_data_emtr_denominations is created but it does not have my 2 custom columns.

At what point in this process should I tell Drupal to use my custom field_schema?


texts: How do I download an image/file to a specified location on the disk?

texts:
I want to provide the functionality to the users to download the images/files to their system but not with direct download but with a dialog where they tell the location where they want to download the image.

I have tried the download_file and file_force modules. Both modules provide the field formatter to download the image. but when the user click on the download link the the image directly downloads, it does not provide the option to the user to specify a location for the image to be downloaded in.

Is there any other module or any other method?


texts: Error in simplesamlphp_auth.module: no valid attribute set

texts:
I'm configuring my application as a saml provider and for this I have used simplesamlauth module. This module (simplesamlphp_auth) provides the ability to make a Drupal site into a SAML Service Provider (SP).

Now while configuring this module, I'm confused about the values that it will take as inputs.

I used SAML tracer, where I'm getting SAML response. Is it from here I will get any kind of attribute that need to be configure at /admin/config/people/simplesamlphp_auth/sync page?

Because right now it is giving me error:

  Error in simplesamlphp_auth.module: no valid \"nameid\" attribute
  set.\" at
  /var/www/html/modules/contrib/simplesamlphp_auth/src/Service/SimplesamlphpAuthManager.php
  line 165",

What would be the unique identifier for the user and username for the user?


texts: I worked out a way to hide fields with field permission module on registration. But have not found a way to hide whole field groups. Is there a module or a particular API which can help with this problem.


texts: How do I show a "read more" link in my RSS feed?

texts: I need to trim down my RSS feed so that people come back to the site to read the full article, how might I do this and is there a preferred / best method?


texts: Programmatically, alter the date_format of a field in a view.

texts:
I'm using Drupal 7 and I need to alter, programmatically, the date_format of a field in a view.
I'm using the hook_views_pre_build where I added these lines

if ($view->name == 'my_view') {
  $view->display['page']->handler->display->display_options['fields']['my_field']['date_format'] = 'my_format';
}

but it doesn't alter the old date_format value.

Do you have any suggestions?


texts: How to make Username as non mandatory on Drupal 7 registration form?

texts: I am working on a project where i want to remove the Username form registration from. Is it possible? How?


texts: I need to get vocabulary ID by term object.Please see attched screenshot for term object.


texts: How can I redirect a user after login to the current page?

texts:
I have a Drupal 8 site. And I have approximately 5 pages in a site.

For example if a user hits login from the contact-us page the user should not redirect anywhere, they should stay on same page. How can I accomplish this?


texts:
I have created a grid in views in which there are stored webshops (it's for a website on which you can find all kind of webshops). It shows a picture, a title and a bodytext for each webshop. And now I would like to edit the images only for that page in a seperate id.
Only I have no idea how i should add an id for the css of the image, how is this possible in drupal, css or php?


texts: How to remove "Drupal" from title of page?

texts:
Now I have this:

Here i found information how to change this text to anything else:
https://www.drupal.org/forum/support/post-installation/2016-09-20/change-site-title-in-drupal-8

I tried:

But it doesn't help.

Drupal is 8.4.2

And it works on 8.0.6


texts: How can I programmatically apply text formats?

texts:
I've created a custom text format I'm trying to apply to a field programmatically. As best I can tell, the format IS getting applied, but it is not stripping HTML tags like it is supposed to. The below screenshot shows how my text formatter is configured:

As you can see, its supposed to filter <span> tags. The Nodes where this will be used get created programmatically, and I apply the text formatter as follows:

'field_career_job_description1' => ['value' => $job['jobdesc'],'format' => 'careers_html_formatter']

This appears to be working correctly, if I print the variables passed to twig, I see that the formatter is, indeed, my custom format:

However, as you can see in the sshot, <span> tags are still in the text.

Note that I am displaying the field in question in Twig as follows:

{{ content.field_career_job_description1[0]['#text'] | raw }}


texts: Ordering by taxonomy field ascending but leaving those node without taxonomy at the bottom

texts:
I have a View of products (nodes). They have taxonomy associated, and I am displaying the taxonomy first and ordering by taxonomy ascending. However, I would like to have all with taxonomy ordered first, but I find that the View shows first those without taxonomy, and later those with taxonomy, in this case in the correct order. How could I indicate the View that it must reserve those without taxonomy for the last, i. e.

 A Taxonomy
   - Product 1
   - Product 2
 B Taxonomy
   - Product 3
   - Product 4
 ...
 Z Taxonomy
  - Product 5

  -- Products with No taxonomy -- (this message does not display, it is only for clarification here)
  - Product 6
  - Product 7

...


texts: How to implement multiple approvals with emails?

texts:
I am currently using the Webform module, but I can't find a way to make a workflow that works for what I am trying to do.

Please let me know if I am approaching this incorrectly, or if I should be using a different module.

This is basically how I want the steps to work:

User fills out a Webform and submits it. (one of the fields in the form is his/her supervisor's email). The form then enters a state called "Pending"
The form is sent to the entered Supervisor's email.
If the Supervisor wants to approve it, he/she will change the state to "Approved". If he/she feels that more approval from someone higher up is required, then he/she can change the state to "More Approval" needed and then enter the email of their supervisor.
If the Supervisor's Supervisor likes it, then he/she can change the state to "Approved"
When the state is at approved, HR is notified.

Is doing something like this possible? If so, how can it be done?


texts: I uploaded some images in content. the images are uploaded to "sites/default/files". but in node page the images are referring "sites/default/files/styles/large" path. how to change it?


texts: How to enable caching for ajax callbacks, especially for colorbox node?

texts:
I am using colorbox node module on my site, and it looks like the ajax callbacks for rendering the node are not cached at all. Tested it with a simple snippet in the node template:

generated on <?php $dt=new DateTime();print $dt->format('d.m.Y H:i:s');?>

Colorbox is using a custom display, to have a custom node.tpl

function mytheme_preprocess_node(&$vars) {
  if ($vars['node']->type == 'my_content_type' && $vars['view_mode'] == 'colorbox') {
    $vars['theme_hook_suggestions'][] = 'node__my_content_type__colorbox';
  }
}

Caching for anonymous user is turned on and works for node pages.

is this issue related to colorbox node (e.g. missing caching implementation in colorbox node) or some other module?

I dived into the code of colorbox node and found out that the click on a colorbox link will be rewritten and rerouted through this menu:

/*
 * Implements hook_menu().
 */
function colorbox_node_menu() {
  $items['colorbox/%colorbox_node_url'] = array(
    'page callback' => 'colorbox_node_output',
    'page arguments' => array(1),
    'access arguments' => array('access content'),
    'load arguments' => array('%map'),
    'delivery callback' => 'ajax_deliver',
    'theme callback' => 'ajax_base_page_theme',
    'type' => MENU_CALLBACK,
  );
  return $items;
}

is there a way to cache 'delivery callback' => 'ajax_deliver', without hacking the colorbox_node_output() function? Whats the best practice here to get this into caching? I think implementing a cache inside colorbox_node_output() might already be too late because it is running through the complete bootstrap process before executing that function.


texts: different sort criteria depending on term ID

texts: I'm using views for my taxonomy term page. I want to sort the nodes in some categories by title, while nodes in other categories by weight. I've been poking around the views UI but I can't figure it out. I was thinking that I probably should implement some hook or create a custom query but I don't know where to start. How do I achieve this?


texts:
I have a content type called Project which can relate to n projects of the same content type. This is done with a field called related projects using the D8 core Entity References. A possible relationship could look like that:

            Project B
          /
Project A
          \
            Project C

Project templates should show all linked projects in both directions. Also would be great to edit the relations in both ways, when editing Project A but also when edition Project B.

This works fine for projects which have projects defined in the Related Projects field, like Project A in the example. But it doesn't work out for referenced projects like Project B and Project C. This is because of the directed nature of Entity References.

I try to use Corresponding Entity References module which "syncs the node reference between two node types which have a nodereference to each other" configuring it like that on /admin/config/content/cer:

First field: related_projects
Second field: related_projects
Package: Node: Project

But Project B and Project C don't get updated when saving Project A. What am I doing wrong? Or is there another possible solution for syncing node references?


texts: Change the Source DB for migrating via Drush

texts:
A few days ago I originally ran the full migration via the UI to get the site up and running and cleaning up any bugs from a DB instance that is a copy of the current live site. However, now that the site is up and running, I would like to re-migrate just the users from a NEW copy of the current live site in order to have an up-to-date data before going live (instead of losing any changes users made over the last few days).

I don't want to re-migrate through the UI because I just need to migrate users
I tried adding a $databases['migrate']['default'] setting in the settings.php file but migrate-import doesn't have any option like --legacy-db-key
drush migrate-status gives me an error because I deleted the backup db after I successfully migrated, but can't figure out a way to change the source DB

How can I change the source DB for the migrate drush commands in order to run a migration on just users via the drush migrate-import command?


texts: How to give user permissions to edit other user fields except user id & pwd?

texts: Hi i am using drupal 7 website in my site having 3 different role of users 1st role of users need to edit 2nd role of user fields  except user id & pwd & email & roles.i have tried with administer user permissions,it is possible to edit user id and pwd.Also i have tried with user protect module no use,Any suggestions on this it will be very helpful.Thanks in advance.


texts: Is it possible, not only to give a CCK field a default value, but also make it non-editable by the user?


texts:
I have a content type that has title, body, image etc. I am displaying the Title, image with caption and body using Manage Display. But here there is no option to align (Left, Right, Center) the image. How to align the image node wise.

OR

Is it possible to add a class to an image field of a node wise.


texts:
I have a custom module that shows node in ajax mode with hook_menu() .
how can i show nodes from menu in ajax mode .
here is my code :

    <?php

/**
 * Implements hook_menu().
 */
function sample_ajax_menu() {
  $items['sample-ajax/page'] = array(
    'page callback' => 'sample_ajax_page',
    'access arguments' => array('access content'),
    'type' => MENU_NORMAL_ITEM,
  );
  $items['sample-ajax/nojs/%node'] = array(
    'page callback' => 'sample_ajax_callback',
    'page arguments' => array(1, 2),
    'access arguments' => array('access content'),
    'type' => MENU_NORMAL_ITEM,
  );
  $items['sample-ajax/ajax/%node'] = array(
    'delivery callback' => 'ajax_deliver',
    ) + $items['sample-ajax/nojs/%node'];

  return $items;
}

function sample_ajax_page() {
  drupal_add_library('system', 'drupal.ajax');
  return array(
    '#markup' => l(t('Click here'), 'sample-ajax/nojs/1', array('attributes' => array('class' => array('use-ajax')))),
  );
}

function sample_ajax_callback($ajax, $node) {
  $is_ajax = $ajax === 'ajax';

  if ($is_ajax) {
    $commands = array();
    $node_view = node_view($node);
    $commands[] = ajax_command_html('#block-system-powered-by div.content', drupal_render($node_view));
    return array(
      '#type' => 'ajax',
      '#commands' => $commands,
    );
  } else {
    return node_view($node);
  }
}

when i add use-ajax class to links in main-menu i get error
Upadte

any idea ??


texts: No results view filtering on newly added field of content type

texts:
I have a content type called Parts. I just added a new boolean field called is_accessory with the default value being false. I added a filter on an existing view to show only Parts where is_accessory is false. When I run the view, no parts show up.

If I go to a Part page, select edit, then select save (without changing anything) that part will show up.

Do I need to write a hook_update_N function that loads and saves all the Part records?


texts: How to name multi-sites for different environments (dev and staging)?

texts:
I have a Drupal project that is a multi-site setup. I currently have my sites named like so:

sites/site1.example.dev
sites/site2.example.dev
sites/site3.example.dev

This is fine for working locally in development, as I can point my browser to site1.example.dev, site2.example.dev, or site3.example.dev and it works. However, when I push this up to staging, I want to be able to access these sites at the following addresses:

site1.example.com
site2.example.com
site3.example.com

Is it possible to simply name these as "[specific_name].example" and configure it so that I don't need to rename/update depending on the environment?

Thanks.


texts: How to choose what tables to skip for drush sql-sync @dev @staging?

texts:
Following my previous question
How to set Drush sql-sync not to clone users between @dev and @staging?
I have manually preselected over 80 tables that should not be automatically synced (content, roles and permissions, users, temporary, cache). I am not fully satisfied with this solution. Why? Because my filter decisions is based on experience, intuition and guess when I would like to use the best practice method.

How to properly choose what tables to skip for drush sql-sync @dev @tst and drush sql-sync @production @staging?

My setup:
git.drupal.org ==> local drupal git repository ==>  @dev -> @tst -> @staging -> @production (configuration, static content, roles and permissions)

@staging <- @production (content, production scenarios to be tested)

The Definitive Guide to Drupal 7 by Benjamin Melançon and others says:

  Here is the list of tables that appears in example.drushrc.php:

$options['structure-tables'] = array(  'common' => array('cache',
  'cache_filter', 'cache_menu', 'cache_page', 'history', 'sessions',
  'watchdog'),
);

  You may need to add some more tables to this list. A good place to
  start would be to consider the list of tables that contain cache in
  their name via drush sql-query 'show tables;' | grep cache

  Remove from this list tables such as imagecache_action and so on, and
  add the remainder to your structure tables list.

  After you do an sql-sync with skipped tables, you will need to clear
  the cache on the target site to make sure that things work right.

What are the other tables to consider? Why?


texts:
I have used given below code for node--[content_type].tpl.php (default) template file

function MYMODULE_theme($existing, $type, $theme, $path) {
  return array(
    'node__NODETYPE' => array(
      'render element' => 'content',
      'base hook' => 'node',
      'template' => 'node--NODETYPE',
      'path' => drupal_get_path('module', 'MYMODULE') . '/templates',
    ),
  );
}

but I don't know how to call my node--[content_type]--[view_mode].tpl.php

Please suggest.


texts: Is there a way to run hook_form_alter after themes implementation?

texts:
I'm using the material_admin theme, which has a hook_form_alter()  implementation.

I see that my module's hook_form_alter() is executed before the theme hook. Both hooks are editing the same form property, so the change done in my code is always overridden.

In my hook_module_implements_alter() implementation I see only the modules that implement hook_form_alter(). The theme's implementation is not there.

How can I control its execution?


texts: Views aggregation, sum of node count in _each row_

texts:
I have a View that uses aggregation to count the number of nodes of a custom color type. For example, there are 10 red nodes, 10 green nodes and 20 blue nodes. For each color, I would want it's node count and the total count to show up on each row, like this:

Color    Count   Total
Red       10      40
Green     10      40
Blue      20      40

Ultimately, I do want to calculate the percentage in each row as well, but for now I'd just like the total.

What's the most efficient "drupal" way of doing this?


texts:
How can I create 2 displays of a products node one for Authenticated users and one for anonymous ?

I am trying to create a single products display for my site that will display the product image and all of its fields for a single product basically like most eccomerce stores do with the image on the left and all the details on the right

there needs to be two versions of the display one for anonymous users that will display product without the add to cart button and price fields and rather display Text stating "we do not supply directly to the Public"

and then another display for authenticated users that will display the price and add to cart button.

this was easy to do for the grid views of products on my site I just created 2 views with role based access but for the actual single products node I aparently cannot use views because it is a node.

I am thinking I need to use display suit but how can i create 2 displays and use role based access.


texts: Notify user by email when matching content is uploaded

texts:
I'm setting up a real estate website that sends an email to a user notifying them when a property meeting their specifications is uploaded.

Any ideas how I can do this in drupal 6/7 ?


texts:
I am have a website on drupal and have enabled  Bootstrap theme .
The problem is http://netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css is not loading .
It says "This webpage is not available" when i try to load

http://netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css

in ubuntu ,

But when works fine in windows.

I have no idea why is this happening .
Plz help.


texts: User list view showing total nodes created for each user

texts:
I have a view which displays a list of particular users. For each user displayed I would like to also display the total number of nodes that user has created.

I was wondering if there was an easy and/or efficient way of doing this, or if there is a module available that can? Obviously you would not want to calculate each total on the fly, but rather have the totals cached and updated whenever a user creates/deletes a node.

It would be nice if a module existed that could take care of this aggregate accumulation, and not just for node creation/deletion but for any desired aggregate (per user, or per node, etc).

Any help is greatly appre


texts: How to stop the book module defaulting to IE7 standards mode?

texts:
I currently have a problem whereby when visiting a page created with the book module it forces IE into IE7 standards document mode.

I am running Drupal 7 with the Omega 3 base theme.  I have disabled the RDF module and added:

<meta http-equiv="X-UA-Compatible" content="IE=Edge">

Which forces all other areas of the site to render correctly, just not in the book module pages.

Has anyone else come across this problem?


texts: Locations geocoding to province, not country

texts:
I previously asked a question but since have done much research and am getting more focused on my problem.

I have a locations cck field in a profiles 2 profile. Here, I get users to select just countries (no cities or provinces) and they are geocoded to points and displayed on a user specific map. Many of the countries are not accurate. I have discovered the locations are being geocoded by their province code. Example: the country code is being ignored and it is selecting a province code.

I had a problem that Barbados was being displayed in Germany. Barbados has a country code of "BB", but I found that the point was being displayed in Brandenburg Germany, the province code "BB". Every wrong point can be explained this was but 3.

I have the geocoding setup to be at a country level accuracy. I dont think its a config problem and I have yet to find any other people with this problem.

Any ideas on what to do?

Thanks


texts:
I want to disable the user/register page in Drupal 7 but I still want registrations possible, but only through other links. I've tried altering the access to it through a module like so:

my_module_menu_alter(&$items) {
     $items['user/register']['access callback'] = FALSE;
}

but it does not seem to work. I know I can alter the form permission and set it to false but I need the form for other modules I have installed. Is there any way to do this with a already existing module or programmatically?


texts: How to combine content from two different environments?

texts:
We have two Drupal environments: dev and prod.  We use dev to stage content before it goes to production.  We also have prod, where content is created and then have to manually re-create those changes back on dev.

Is there a way to combine/merge content changes between the two environments simply/easily?  This is purely content (i.e. nodes) and not code or configuration.


texts: How to allow access to page variant (Page Manager) if user belongs to list

texts:
The Situation
I have an ECK entity called "Event" in my Drupal 7 site.
I have an entity reference field on Event that collects users who flag the Event with a non-global flag called "Sign up" via a rule.
I use Page Manager to control how an Event entity is shown to the users.
My context:
Edit relationship "User from Event (on Event: List of attendees [field_attendees]"
Event: Entity being viewed
Identifier: User from Event Attendees [field_attendees])
Keyword: event_attendees
Delta: 0
Here is the Selection Rule:
User: compare    logged_in_user is User from Event Attendees [field_attendees]
The Problem
As you can see, one of my Page Variants has a selection rule that checks if the logged_in_user is on the list of attendees but it doesn't work because the selection rule takes a "delta" and that means that it takes a hard coded integer to select one of the list. And if I leave this empty, it automatically takes "0" i.e. the first one in the list. There seems to be no option to set the delta to include all or any.
The Question
How can I create this selection rule to check if this user is 'on the list'?


texts: D6 i18n slow due to huge locales_source table. How can I speed things up?

texts:
I'm working on a site that slows down to an unbearable crawl when you view it in a different language (specifically "zh-hans"). When looking at the Devel query log, this appears to be because this query takes about 5 minutes:

SELECT s.source, t.translation, t.language
FROM locales_source s
LEFT JOIN locales_target t
  ON s.lid = t.lid
  AND t.language = 'zh-hans'
WHERE s.textgroup = 'default'
  AND s.version = '6.25'
  AND LENGTH(s.source) < 75

The reason it takes so long is that the locales_source table has almost 1 million rows, even though there are only 1 thousand nodes on the site. This seems like an extremely large amount to me. So my questions are:

Is this normal?
If not, how can I go about identifying which of the data in locales_source is not applicable or bad? I can't find the way to map it back to the original source (node body, title, menu item, etc.) so I'm not sure how to determine if the original source exists and is valid.

Re: #2 above, the locales_source table looks like this, if it helps.

+-----------+--------------+------+-----+---------+----------------+
| Field     | Type         | Null | Key | Default | Extra          |
+-----------+--------------+------+-----+---------+----------------+
| lid       | int(11)      | NO   | PRI | NULL    | auto_increment |
| location  | varchar(255) | NO   |     |         |                |
| textgroup | varchar(255) | NO   | MUL | default |                |
| source    | blob         | NO   | MUL | NULL    |                |
| version   | varchar(20)  | NO   |     | none    |                |
+-----------+--------------+------+-----+---------+----------------+


texts: How do I do namespacing in a module from an external project which is not in the src directory?

texts:
Based on Why do I have conflicts in namespacing? I adjusted my complete system.

As long as I do namespacing in /src, it is goes all very well.
I included my project from Github. Those class files are located in modules/custom/tb/vendor/ccxt/ccxt/php.

When not working with namespaces I included them with include "vendor\ccxt\ccxt\ccxt.php";.

How should I include those classes to module? Because of the Composer structure, those files are in  the vendor sub-directory.

Because of namespacing in Drupal, use \Drupal\tb\<classfile> doesn't work.

The content of the composer.json file is the following.

    "name": "org/tb",
    "description": "This extension provides new commands for Drush.",
    "type": "drupal-drush",
    "authors": [
        {
            "name": "Author name",
            "email": "author@example.com"
        }
    ],
    "require": {
        "php": ">=5.6.0",
        "arcturial/clickatell": "^3.0",
        "ccxt/ccxt": "^1.14"
    },
    "extra": {
        "drush": {
            "services": {
                "drush.services.yml": "^9"
            }
        }
    }
}


texts:
I have a website with subdomains set up, the naked domain without any subdomain gets cached by boost and there is the message by boost in the footer. But any subdomain does not get cached. We are using the sites module http://drupal.org/project/sites, to split the subdomains into different drupal sites.

We have this error  on the status  report page - Boost crawler did not get a 200 response; 302 returned instead.

my boost settings

  ### BOOST START ###
  AddDefaultCharset utf-8
  FileETag None
  <FilesMatch "(\.html)$">
    <IfModule mod_headers.c>
      Header set Expires "Sun, 19 Nov 1978 05:00:00 GMT"
      Header set Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"
    </IfModule>
  </FilesMatch>
  <IfModule mod_mime.c>
    AddCharset utf-8 .html
    AddCharset utf-8 .css
    AddCharset utf-8 .js
  </IfModule>
  <FilesMatch "(\.html)$">
    ForceType text/html
  </FilesMatch>
  <FilesMatch "(\.js)$">
    ForceType text/javascript
  </FilesMatch>
  <FilesMatch "(\.css)$">
    ForceType text/css
  </FilesMatch>

  # NORMAL - Cached css & js files
  RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.css -s
  RewriteRule .* cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.css [L,QSA,T=text/css]
  RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.js -s
  RewriteRule .* cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.js [L,QSA,T=text/javascript]

  # Caching for anonymous users
  # Skip boost IF not get request OR uri has wrong dir OR cookie is set OR request came from this server OR https request
  RewriteCond %{REQUEST_METHOD} !^(GET|HEAD)$ [OR]
  RewriteCond %{REQUEST_URI} (^/(admin|cache|misc|modules|sites|system|openid|themes|node/add))|(/(comment/reply|edit|user|user/(login|password|register))$) [OR]
  RewriteCond %{HTTP_COOKIE} DRUPAL_UID [OR]
  RewriteCond %{HTTP:Pragma} no-cache [OR]
  RewriteCond %{HTTP:Cache-Control} no-cache [OR]
  RewriteCond %{HTTPS} on
  RewriteRule .* - [S=1]

  # NORMAL
  RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html -s
  RewriteRule .* cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html [L,T=text/html]

  ### BOOST END ###


texts: Add extra obligatory fields when editing a node as anonymous user

texts:
I need a way to either add extra fields or make two fields obligatory when an anonymous user is editing a node. I'll explain:
There is a node type in my site that can be freely edited, modifications are saved as new revisions. To know who edited a node i want to add a mail field and other extra fields that require other info from the anonymous user but these fields don't need to be obgligatory when the nodes are edited by registered users.

I was thinking about using the module suggested in this discussion: How can anonymous users be allowed to post while still maintaining content integrity?
but i require that the mail entered from the user is saved inside the node and also i require an extra field other than the mail.

Is there any way to achieve that?


texts: How do I create a contant managed list of linked images and display it as a block?

texts:
On the homepage of the site I'm making I need to have a few CTAs (calls to action) linking to products in the shop, which is running Drupal Commerce. The CTAs comprise of:

An image
A link title
A URL to a product display node
A limit of 2 CTAs

Is there any way I can do this using Views 3 (I'm guessing that would be the best way, please correct me otherwise) without writing my own module? I only have  a very basic understanding of writing modules.


texts: Taxonomy term name alias in taxonomy term autocomplete

texts:
I'd like to have two or more names for one Term-ID in my custom taxonomy dictionary. As for now I've added a custom field and named it "Synonyms". The field can have multiple values.

How can I display values of the "Synonyms" field in the autocomplete taxonomy widget (or even a list control) together with original names of the terms (is there any way to do this?).

Real life example:

tid  |name              |synonyms
_____|__________________|___________________________
1    |sneakers          |gym shoes, tennis shoes

The main name would be: sneakers but while tagging a user may also type: "tennis shoes" into autocomplete and it will link the node field (for example: "Shoes type") with sneakers (tid 1).


texts: How to get the type of Paragraphs entity in the parent node field?

texts:
I have a "page" node with a paragraphs field field-ref-para-multi and the corresponding template field--node--field-ref-para-multi--page.html.twig.

And I have some paragraphs types that can be used in this field:

para_a

para_b

para_c

I have to place a surrounding html structure in the field depending of the paragraphs types that are used inside.

{# type a #}

{% if multiple %}
    {% for item in items %}
        {{item.content}}
     {% endfor %}
{% else %}
    {% for item in items %}
        {{item.content}}
    {% endfor %}
{% endif %}

{# type b #}

{% if multiple %}
    {% for item in items %}

{{item.content}}

     {% endfor %}
{% else %}
    {% for item in items %}

{{item.content}}

    {% endfor %}
{% endif %}

But how to get the type of the used paragraphs in the field template?


texts: Submit a custom form as a webform submission

texts:
I have a custom form i created using FAPI and i wanted to submit the values into the webform  database table and/or content type as a node. i wasnt sure of the "drupal Way" of doin this. Here's my current submit  function, Please tell me if im doing this correctly or if not what is the correct way? (P.S. i dont want to use a different r another module or save to my own custom table.)

function contracts_webform_submit($form, &$form_state) {
 module_load_include('inc', 'webform', 'includes/webform.submissions');
 module_load_include('inc', 'webform', 'includes/webform.components');
 global $user;

$node = $form['#node'];
$sid = $form_state['values']['details']['sid'] ? (int) $form_state['values']['details']['sid'] : NULL;

// If there is no data to be saved (such as on a multipage form with no fields
// on the first page), process no further. Submissions with no data cannot
// be loaded from the database as efficiently, so we don't save them at all.
if (empty($submission->data)) {
 return;
}

 // Save the submission to the database.
if (!$sid) {
 // No sid was found thus insert it in the dataabase.
 $form_state['values']['details']['sid'] = $sid = webform_submission_insert($node, $submission);
 $form_state['values']['details']['is_new'] = TRUE;

 drupal_set_message(t('The form has been submitted.'));
 }
}


texts: How to use jquery ui tooltip in Drupal7?

texts:
I want to use jQuery UI tooltip in my Drupal7 website.

I have installed 'jquery-update' and 'jquery-plugins' module and added

$(function() {
   $("a").tooltip();
});

in js file of my template. But firebug gives this error to me:

$(...).tooltip is not a function

that show the website doesn't find tooltip js file.

Should I do something more to use tooltip jquery ?


texts: I'm using Drupal 7.8, and am trying to get the user to specify a date using the drupal date form. I want to take this date, and save it to a database as a unix timestamp. The trouble is, I think the data given by the date form is based on the user's current timezone. Does drupal provide anyway to convert the form data back to unix time? Is there an easier way to handle dates?


texts: Domain Access with different folders per domain

texts:
I was wondering what the possibility is of having domain access run our sites and yet still have different folders per domain.  So the /sites/[domain-specific-foler] structure that is mandatory for the traditional multi-site install I want replicated for the domain access.

Is this feasible or is it not possible?  Thanks.

I am using drupal 7.x, no shared hosting.


texts: Configure page title block for contact form pages only

texts:
I want the page title block to display on the contact form pages, because the nodes have their titles in their display.

It seems for a form you can't add the title to the form display, thus leaving me with the option to display it via the page title core block.

What I've tried as configuration for the block under visibility:

Contact form bundle: none selected (= for me, assuming: all)

Custom menu link bundle: Negate the condition (= for me, assuming: none)
Content type: Negate the condition (= for me, assuming: none)
Redirect type: Negate the condition (= for me, assuming: none)
All other configurations -> untouched (= for me, assuming: all)

But, the page title is never being displayed. Only when I deselect everything I see my page title... but I only need it on some pages.

Summarized, I want to only display the page title on specific pages, in a structural way (which means: no CSS hack)


texts: How to create automatically a view of all nodes sharing the same field value?

texts:
Working with Drupal 7.54 and Views 3.15

For each content type field, I need to display a link (after the value) which returns a view of all nodes sharing the same field value.

I manage to get my link (field - rewrite results and add a link with tokens) but I need to create a view (with specific contextual filter related to the field) for each field.

Is there a way to build this so I do not need to create x views for x fields? Any token for the field? Any PHP contextual filter using field_name and field_value?

Thanks in advance.

Example :

Node 1

Field A : value x (link)
Field B : value y (link)

etc.

The link returns a view :

All nodes with value x for Field A

Node 2
Node 7
Node 15

...

Related questions :

Create a view of all nodes that have the same value for a specified field as the current node


texts: Create content after editing other content-type

texts:
I have a certain content-type B with an entity reference to items of content-type A.

I'm trying to programmatically create a content-type B node when a bool field in content-type A is set to true, whether during creation of content-type A or update/editing of content-type A.

Something like this story:

  When user creates or edits a news content (ie, sets the push_to_slider field as true), create a slide content if it doesn't exist. If the user sets the field as false, delete the slide content.

I've been exploring how to do this, and I found out about hook_entity_presave. So, right now, I'm able to check what was edited in the content-type A form, and if it is being created or updated.

My questions are:

How can I find out the ID of the content-type A node? I need to know it so I can pass it along when I getStorage('type-B')->create(array). This might be available when editing a A-type node, but not when inserting it, at least not in hook_entity_presave. As far as I can tell, I might be doing this in the wrong place as this hook operates before the DB insertion, is this correct? As such I think I wouldn't have access to an ID at this point. What could be the alternative?
Also, how can I find out if a B-type content already exists referencing the A-type node I'm working with? I intend to use that to find out if what I need to delete in case the option in the form is set to false.

Hope this makes sense. If not, let me know and I'll try to clarify. Any help would be very appreciated.


texts: How to group uploaded documents into folders?

texts:
I want to group my documents in sub folders... when i upload the document using core upload module, i want that those modules get categorised under different section and a user can see those and when he selects an optio then all the files under that folder gets displayed.

i am using drupal on shared web hosting.


texts: Zen theme doesn't append content titles to breadcrumbs

texts:
I've inherited a site with a subtheme designed on Zen 7x-5.4 to maintain and I'm having a problem with the breadcrumbs. I've checked the append content title to breadcrumb options in Appearance=>Settings however this doesn't seem to have any effect on the breadcrumb trail (i.e. the individual content page titles aren't displayed in the breadcrumb). So, I assume something must be overriding the breadcrumb settings through the UI. I'm not sure what that could be, or where it would be set/configured. I've looked through the template.php, and theme-settings.php files. I have the following options set in the mytheme.info file

settings[zen_breadcrumb]           = yes
settings[zen_breadcrumb_separator] = ' › '
settings[zen_breadcrumb_home]      = 1
settings[zen_breadcrumb_trailing]  = 0
settings[zen_breadcrumb_title]     = 0
settings[zen_skip_link_anchor]     = main-menu
settings[zen_skip_link_text]       = Jump to navigation
settings[zen_html5_respond_meta][] = respond
settings[zen_html5_respond_meta][] = html5
settings[zen_html5_respond_meta][] = meta
settings[zen_rebuild_registry]     = 1
settings[zen_wireframes]           = 0

But changing the breadcrumb trailing or title values to 1, and flushing the theme registry didn't pull anything off.

For further context, I do have one breadcrumb set with the Path Breadcrumbs module. For development purposes I have css aggregation turned off.

So, what is preventing my theme from adding the content title to the breadcrumbs and or how to do find where the conflict is?


texts: How to use Font-your-face fonts with CKEditor?

texts:
I am using some Google fonts via the Font-your-face module on my D7 website as well as CKEditor for content editing. To achieve full wysiwyg effect I would like to display the text in editor with these Google fonts. However I can't find the way to to this.

Should I give a try to the appropriate CKEditor plugin or is there a way to solve this on Drupal level? Any ideas?


texts: Can I allow users to choose what input widget a Drupal field should use on a node by node basis?

texts:
This is a question I've asked on Stack Overflow but perhaps this is a better place for it. Apologies if this is seen as cross-posting...

I have a "transcription" field available within a content type in Drupal 7. Is there a way I can add a switch to allow the user to select whether that transcription content should allow tabular data input (via the TableField module) or whether it should be rich text/html?


texts: Drupal 6 as a call logging system - question about node performance & scalability

texts:
We currently use Drupal as a Knowledge, communications and assessments system for our call centre agents and it is working great. However there has been a request that this to also handle our call logging.

We utilise profiles to allow manager roles to check their team members assessment scores and what communications they have read, the idea is that they could also do the same with calls taken.

My concern here is that this will dramatically increase the number of nodes from what we have now (articles, comms etc are all created by our team so nodes will be within the 1000's).

If we employ Drupal for logging calls this would mean that our 1000's of agents would be creating dozens of call logs per day. This potentially would push nodes up into the 1000000's.

Would Drupal and its node / cck be able to cope with this type of load where 1000's of users would be submitting dozens of nodes simultaneously?


texts: Drupal 7.14 include old removed javascript files

texts:
I've included at some point some javascript files via :

<?php
drupal_add_js('my_file.js');
?>

I removed those files, but now, I've got 404 errors even if there is no call or instructions at all to include them.

I clear my cache, remove cache from database, remove site/all/default/files/js/*...

Don't really know what to do now.

Thanks in advance!


texts: How to write custom Form API elements for Drupal 7?

texts:
In context of this question I wanted to ask - how to provide custom controls to use with Form API? Especially ones that needs to be exploded into javascript and at least one additional hidden field to make their GUI work.

I can find manuals for Drupal 6 easily enough, but somehow I can't spot ones for 7. I know I need to start with hook_element_info(), but hook's description for Drupal 7 points to a manual for Drupal 6.

Could anyone provide step-by-step instruction how to make it work?


texts: Is there way to use existing content type field to custom form in drupal?

texts:
I want to use existing content type field in my own custom form.
Like In content type, we can use existing field.


texts: Drush can not connect to mysql when run a Drupal in a Docker/Azure

texts:
I have a website that it's running ok in Docker/Azure.

I have this configuration in my settings.php

$databases ['default'] ['default'] = array (
    'database' => getenv ( 'MYSQL_DATABASE' ),
    'username' => getenv ( 'MYSQL_USER' ),
    'password' => getenv ( 'MYSQL_PASSWORD' ),
    'prefix' => '',
    'host' => getenv ( 'MYSQL_HOSTNAME' ),
    'port' => getenv ( 'MYSQL_PORT' ),
    'driver' => 'mysql'
);

When I make drush status

I get this.

 Drupal version   : 8.7.3
 Site URI         : http://default
 DB driver        :
 DB hostname      :
 DB port          :
 DB username      :
 DB name          :

Any idea how to make that Drush get the mysql configuration options?

Thanks


texts: How can I invalidate a cache on a specific View?

texts:
I am facing a situation where I need to invalidate a specific View in order to initiate clearing the cache on that View.

views_invalidate_cache() clears ALL cached Views data, for every View on the site.

How can I trigger a cache invalidation for a specific View from inside my module code?


texts: Error while creating a node with file attachment through custom PHP code

texts:
I need to programmaticly create  a node in Drupal 7 i followed availible tutorials and came up with this code:

define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

$md5 = md5(strtotime("now"));

$field_customer_name = 'NAthtn';
$field_customer_email = "something@gmail.com";
$field_downloads_count_left = '11';

$filename = 'file123.zip';
$filepath = 'sites/default/files/private/file123.zip';

// Create managed File object and associate with file field.
$file = new StdClass();
$file->uid = 1;
$file->uri = $filepath;
$file->filename = $filename;
$file->filemime = file_get_mimetype($file->uri);
$file->status = 1;
$file = file_copy($file, 'public://', FILE_EXISTS_REPLACE);

$node = new stdClass();
$node->type = 'download';
node_object_prepare($node);

$node->title    = $md5;
$node->language = LANGUAGE_NONE;

$node->field_customer_name[$node->language][0]['value'] = $field_customer_name;
$node->field_customer_email[$node->language][0]['value'] = $field_customer_email;
$node->field_downloads_count_left[$node->language][0]['value'] = $field_downloads_count_left;
$node->field_file[$node->language][0]['value'] = (array)$file;

$path = $md5;
$node->path = array('alias' => $path);

node_save($node);

I am getting the following error in the log:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'fid' cannot be null: INSERT INTO {file_usage} (fid, module, type, id, count) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] => [:db_insert_placeholder_1] => file [:db_insert_placeholder_2] => node [:db_insert_placeholder_3] => 51 [:db_insert_placeholder_4] => 1 ) in file_usage_add() (line 664 of /home/content/16/5470416/html/download/includes/file.inc).