texts:
Contemplating a new forum for a D7 site. There are many options floating around out there, and it's not very clear which of the solutions listed below would be the best direction for our use case. And which are still current (some posts and projects are quite old). Advice?

Features we're looking for:

• Has staff moderation. Volunteer moderators can be assigned.

• Private messaging between members.

• Users can earn or be given “badges” and have a nice leaderboard – we would like to use it to create an "expert" vs "new user" atmosphere for Q&A threads, with new contributors asking more seasoned ones (or staff moderators) for advice

• [Advanced] A stub of the most popular discussion(s), i.e. linked title (# of replies) can be pulled into a relevant landing page, using categories or similar to define which forums belong to which landing pages. This is important to bring user generated content into landing pages. An extra bonus would be the feature of over-riding the 'most popular' discussion with another staff featured discussion at landing page level.

• Doesn't require subdomain or iframes to integrate - can reside at something like domain.com/forum/thread or domain.com/landingpage/forum/thread

• Clean and modern UI out of the box or can be themed, responsive for mobile

• Can use Drupal user authentication or replace/supplement it with OpenID or Facebook/Twitter logins

• Includes spam control, though this isn't a deal breaker.

• [Advanced] Comments can get upvotes for helpfulness

And here are the choices that seem to be out there:

1) Core forum module - probably can't do a lot of the above?

2) Advanced forum module - how much of the above can it accomplish? If it can do most, this seems like it could be the easiest option to integrate ...

3) VBulletin - some of the larger Drupal sites with really active forums use vbulletin, typically implemented as a subdomain. There's also DrupalVB https://www.drupal.org/project/drupalvb ; phpBB is also an option

4) Acquia Commons Drupal project/modules

5) Harmony Drupal project/modules

6) Discourse - https://www.drupal.org/project/discourse . New and cool, but maybe their Docker isn't easy to integrate into a complex existing Drupal site.

7) A third party konwledgebase platform like GetSatisfaction or Zendesk. These have nice UIs, a lot of the required features from above, and Drupal integration modules already exist - but integration may still be quite complex...

Ease of integration is important, but so is how full-featured the solution is. And whether it's got a nice, modern UI.


texts:
I have a textarea field in a custom module form , I guess there is ckeditor library by default in core in d8 . I tried the following :

$form['fieldset']['email_template'] = array(
  '#type' => 'text_format',
  '#format' => 'full_html',
  '#title' => t('E-mail template content'),
  '#default_value' => "

" . $dvalue,
  '#description' => t('A valid template for email trigger. Please type ":" for variable suggestions'),
  '#attributes' => array(
                ),
  '#required' => TRUE,
  '#cols' => 60,
  '#resizable' => TRUE,
  '#rows' => 13,
  //'#wysiwyg' => TRUE,
            );

I followed the link : https://www.drupal.org/node/1031160

But the ckeditor is not applying to the textarea as expected . Any idea ??

UPDATE

I was not given the text_format as ckeditor in https://base_url/admin/config/content/formats .

I defined a new format which can apply to which all fields needed as ckeditor . cheers


texts: Migrating XML data with many-to-one relationships

texts:
I'm using Drupal 8's migrate system to import data from an XML source which has this simple layout:

<books>
    <book>
        <isbn>...</isbn>
        <title>...</title>
        <author>...</author>
    </book>
</books>

My code creates 'book' and 'author' entities on the Drupal side, with each 'book' referencing its corresponding 'author'. The problem is that different books can have the same author. This ends up creating a separate 'author' entity for every occurrence of the same author in the XML file.

I've looked at the $row variable in PrepareRow to see if there are ways of manipulating the ID map table to avoid the duplicates but haven't had any luck. So I'd appreciate any suggestions or ideas!

By the way, my code has two source plugins - one for 'author' (which runs first) and another for 'book'. I'm using the 'plugin: migration' in my YAML file to make the book entity pickup the author entity's ID. It all works except that author gets duplicated.


texts: Is it safe to update a field value direclty on the Database

texts: When updating a field attached to a node, Drupal calls several hooks and add a record on the appropriate field revision. Is there any risk if I by-pass this process and update the field value via a sql query.


texts: Is there a way to show a message to specific users?

texts: I would like to programmatically set a message shown at least once for selected users or for all users with a specific role.


texts: Is it possible to inherit a cck into another CCK and assign multiple values to it

texts:
I have been searching stackoverflow, drupal forums, drupal.stackexchange for how to create multiple values for a group. I came across several posts regarding the issue mainly Drupal Custom CCK field with multiple child fields
 and cck multiple groups but I din't find (may be) the exact solution. I even tried Groups module but din't understand how to organize fields.

Is it possible to inherit a cck and call that cck into another cck and assign multiple values to it
I know that node reference field type will do this but can i assign multiple values ?
To be brief:

Now I want to call Asset cck in Events and assign multiple values to it just like eventname- Launching a new iphone

assetname(title of the pdf)-- iphone 5 introduction   Text field
               pdf(link) -- www.mysite/flder/iphone5intro.pdf   File type
assetname(title of the pdf)-- iphone 5 user manual    Text field
               pdf(link) -- www.mysite/flder/iphone5manual.pdf  File type
etc

It can have multiple values and it should also support views

help, and please ignore for any mistakes made, I will be very thankful for any alterations made.


texts: How to add a complete menu as an item in other menus?

texts:
Let say I have 3 MENUS:

MENU 1 with these items:

item menu 1 - a
item menu 1 - b
item menu 1 - c

MENU 2 with these items:

item menu 2 - a
item menu 2 - b
item menu 2 - c

MENU 3 with these items:

item menu 3 - a
item menu 3 - b
item menu 3 - c

I need to add MENU 1 as a clild in MENU 2 and MENU 3 to get this:

MENU 2 with these items:

item menu 2 - a
item menu 2 - b
--item menu 1 - a
--item menu 1 - b
--item menu 1 - c
item menu 2 - c

MENU 3 with these items:

item menu 3 - a
item menu 3 - b
--item menu 1 - a
--item menu 1 - b
--item menu 1 - c
item menu 3 - c

Is there any way to get this?


texts:
I have a function that returns sets of variables. Now, I want to control the return value by using node status. Basically I dont want the value to be returned when the node is unpublished. Any idea? Here is the function by the way. I just need to add a condition in the return value like this if($node->status == 1){ return $omniture_variables; }
function my_module_omniture_variables() {
  $current_day = date('D');
  $current_hour = date('G');
  .....

  $omniture_variables['variables'] = array(
    ....
  );

  //Sets omniture variables
  if(module_exists('omniture')) {
  ....
  }

  if(count($extra_variables) > 0) {
    $omniture_variables['variables'] = array_merge($omniture_variables['variables'], $extra_variables);
  }

  return $omniture_variables;
}


texts:
in my custom module, i am executing a query.

global $user;
$id = $user->uid;
print_r($id);
$query = db_query('SELECT n.nid, c.uid, n.title, f.body_value, fm.uri
FROM challenges c
LEFT JOIN node n ON n.nid = c.cid
LEFT JOIN field_data_body f ON n.nid = f.entity_id
LEFT JOIN field_data_field_challenge_pic fp ON n.nid = fp.entity_id
LEFT JOIN file_managed fm ON fp.field_challenge_pic_fid = fm.fid ');
**// WHERE c.cid = $id ');**

when the where clause is commented out the query runs fine. I check it using:

foreach($query as $q)
{
            print_r($q);
}

But when i add the where clause i get an error: Syntax error or access violation...on the line where i write the where clause. How can i achieve this. Thanks


texts: Entity Reference: User field not displaying unless user is referenced

texts:
I have a field that references users: field_cc. When userA creates a node with this field populated with userB, userA cannot see the field when the node is displayed. If userA references himself, then userA will be able to see the field when the node is displayed.

This was on a clean install, no other permission-type module installed. Also tried fixing this with the Field Permissions module but this is did not help. I went through all possible permissions and settings but nothing seemed to work.

Am I misunderstanding how this module works out of the box?

Thanks in advance!


texts: how to fix this Drupal\commerce\CommerceEntityViewsData' not found

texts:
installed Commerce reports using composer. On enabling the module got an error:
"Fatal error: Class 'Drupal\commerce\CommerceEntityViewsData' not found".
what is the solution for this i searched for CommerceEntityViewsData but i couldnot find what exactly it is please help me.
i'm a newbie
Thanks


texts: Rewrite SQL on a specific content type node on Drupal 7

texts:
I'm trying to rewrite SQL on a specific node type on Drupal 7. I found this, But it only works on Drupal 6-. What's about Drupal 7? Thank you.

https://api.drupal.org/api/drupal/includes%21database.inc/function/db_rewrite_sql/6


texts: How to change default language for configuration entities?

texts:
I made a mistake during the development of my Drupal 8 site. Some time ago I changed the default language (to german) - but I continued to create the configuration entities (like fields and so on) in English.
Now I found out that this was not really smart - and I want to change the default language of all existing configuration entities.
First of all, I just tried to delete the german language - so Drupal 8 switches back to English as default. Now every new configuration entity (new field) is defined in English. That's fine. But every existing configuration entity shows "Unknown (de) (original)" as the default language. And when I open it to save it again nothing changes.
I took a look into the database considering to change it directly there - but unfortunately, the configuration is stored binary.
Is there any other way to solve this problem?


texts: I cannot figure out how to add the search form to a child element in the menu!

texts:
I am trying to get something like this http://www.theverge.com/ on my website where you click the search icon and a search bar drops down, but I cannot figure out how to make it work.  I assumed I could do it with menu_build_tree() but have failed quite a bit, so I moved onto THEME_preprocess_menu_link() and have not figured out how to add a child element to a menu item that already exists to print my search form into.

I am pretty new to programming and even newer to Drupal, any suggestions would help me greatly!


texts: Entity field query condition to match multi-value field

texts:
Using EFQ, I want to add a fieldCondition that has to match both values in a multi-value field (fixed at two values). The following doesn't seem to work:

$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'node')
       ->entityCondition('bundle', 'node_type')
       ->fieldCondition('field_myfield', 'target_id', array(
          $id_1,
          $id_2
        ), '=');

This returns the error:

  PDOException: SQLSTATE[21000]: Cardinality violation: 1241 Operand
  should contain 1 column(s):


texts:
Somehow, edit/delete has been changed to node->title/edit or node->title/delete for one of my project. Can anyone have idea what could be a reason?

Any lead towards the debugging would be appreciated.


texts:
I executed the config:import: import successfully, but now it seems that the theme settings are no longer found.
The site is now seen as in the attached image

How can I solve the problem?

Note: I don't use bootstrap theme. I imported the configuration I had previously exported from another machine on Ubuntu. This problem is on a Windows machine.


texts:
I am using the webform_civicrm module. It is not having the option to link the membership type to webforms.
How can I link membership type to webforms?


texts: How to get language code of a field in a node

texts:
I have a requirement where in hook_node_insert I need to get the language code of a field

What I have tried is

$langcode = $node->{$field_name}->langcode

But this returns null. Any suggestions?

And is it possible that different fields in a node have different langcode?


texts: How do you group multiple fields of a view when the last item is a link?

texts:
I'm grouping multiple fields of a view into a single div by hiding the first fields and rewriting the content of the last field using variables.  The problem is that the last field is a Link node which causes my rewritten content to be wrapped by a link tag.  I only want the link tag around this element where I placed it as a variable.  Is there a way to remove the link tag around the entirety of the rewritten field?

Also, the link node itself is placed as plain text when represented by the [variable].  I would like it to be a link.


texts: Check if the site allows new user registration

texts:
In Drupal 7, on my frontpage custom template, i want to show a text if the site is allowing new users to register.
Any clues?
Thanks


texts: Using theme_preprocess_node i'm trying to add a class to all images on the page

texts:
My code below is not working and i'm not sure why. I've tried a few variants.
according to the KPR variables output, the image I'm trying to access is here.

$variables['field_about_image'][0]

i think the 0 signifies it is the first (and only in this case) image on the page w/ the machine field name 'field_about_image'. so i wrote my code as:

function myTheme_preprocess_node(&$variables){
    if($variables['type']=='basic_page_with_pic') {
echo '<script>alert("my func running")</script>'; //Verified it's working
    $variables['field_about_image'][0]['class'] = 'myclass;
}
}

i've also tried this, just to get a class attribute added

$variables['field_about_image'][0][] = 'class';

also the title attribute comes up as empty. so just as an execrcise i tried this.

$variables['field_about_image'][0]['title'] = 'some title;

any help on how to do this would be greatly appreciated!


texts: How can I setup a template for displaying all nodes of a given type?

texts:
When I enabled the Blog module in D7 it allows a "/blogs/" page to show all blogs and then the standard blog view underneath that for single blog entries; how can I do this with my own content type?

I want to create a list of my image gallery content types that is tailored to my needs, and then have a view for individual galleries, while still keeping items in those galleries as separate nodes.

I've worked out what seems to be a decent way to reference everything, I just can't figure out how to setup a group view for the galleries. I could just make a custom article that uses PHP to query the nodes and do it all through custom articles, but I thought perhaps the Drupal themes setup allows something more eloquent.


texts: Issue with options in ICME file uploader missing

texts:
I'm using Drupal 8 and I added IMCE so that we could upload files. But, some things seem to be missing. First I can only upload images now, there's not option to search the website directories which means that if I have a icon I use in many places I have to upload it each time. You can search the website directories when you link to files though.

Secondly there are no link options like choosing targets like _blank. Is this the way the module works or is something conflicting with it?


texts: How do you set up ubercart to filter/sort by price

texts:
I'm new to Ubercart and just set-up a simple shop (Using Drupal 7 and Ubercart 7.x-3). In the default uc_catalog (table) view you are able to sort by product title.

When going to format -> table settings, there is an option to allow the title field to be sortable, but there is no such option for price. Is there a solution to allow the products in the table to be sorted by price?

I've tried adding a price to the sort criteria but the sort filter doesn't work.

Any help or pointer would be appreciated.


texts: How to hide node webform programatically?

texts:
I want to make hide WEBFORM  particular content type programmatically in default / custom mode.
Any help will be appreciable.


texts:
One of my colleagues setup a Drupal front page for a website. He has left now. I was given access but I am not able to edit the front page. I can edit every other page, but not the front page.

I don't want to replace the front page with another page. I know how to do that by promoting the page.
I want to edit the content of the front page I already have. It has some RSS feeds coming in, a presentation like thing and some pictures. I would like to edit those.

I googled but I cannot find anything substantial. Can anyone please help? I am a noob when it comes to Drupal, so apologies in advance!


texts:
I have a platform independent specification for a web application. I have attached a very small portion of the UML specification posted here. Is it possible to implement the classes as shown by the diagram.

I am not a Drupal Expert and I am having very difficult time in explaning the feaures I want to the Drupal Expernt.

Is it possible to develop content type with this kind of structure and do the data entry from single Page.

It would be great if someone could show me the right direction.


texts: using form_state->set() inside ajax callback but cannot get the value back outside the callback

texts:
I want to add some arbitrary variable to store it in the form_state and use it again so in one of my ajax callback functions I set a property named var:

public function MyFunctionCallback(array &$form, FormStateInterface &$form_state) {
....
$terms = array('1'=>'one','2'=>'two');
$form_state->set('var', $terms);
....
}

it works and the storage array of the form_state has var element

unfortunately when trying to get the var back inside another callback function it returns null.
actually with debugging the storage array of the form_state is empty

public function MyOtherFunctionCallback(array &$form, FormStateInterface &$form_state) {
....
$terms = $form_state->get('var');
....
}


texts: How do I set access permissions per field?

texts:
What I need to do

I have some user account fields that should be administrator-only (read/write/edit).  For example, the IP address used to register.

So, I want to restrict access to administrators.

Current state of field permissions in Drupal 8 (as of Feb 19, 2016)

In Drupal 7, I used the Field Permissions module.  However, a Drupal 8 version is not currently being worked on by the maintainers.
There is a discussion on putting field permissions in Core, but this has been going on for seven years and is marked as "postponed."


texts: How do we set messages now in 8.x? Do we still use drupal_set_message? Not a fan of mixing procedural calls within classes if it can be avoided.


texts: Product Variation Token to fetch field of Product Display (Commerce)

texts:
I am currently trying to automate some stuff, including the product sku as new products are created. For this I am using the AutoSKU module together with Token.

The idea is that every product display has a Base SKU, which I want to define once per product display.

So when you add a new variation to that product display, I want AutoSKU to also fetch whatever string has been put into said Base SKU field, named field_device_sku .

Stuff like [commerce-product:field-device-sku] unfortunately does not work, for the field belongs to the product variation's parent product display.

Is there any way pulling this off without unnecessarily redefining the 'base SKU' inside every product variation?

TL;DR:
For pictures famously say more than 117 words, here an admin panel screeny which might make it clearer what I am talking about and struggling with:

Fetching the desired SKU of the coverage and texture is no issue thanks to taxonomy, but the base sku string I just cant figure how to get. I am starting to doubt it's even possible if it's not defined directly in the product variation.

Any help or hints would be highly appreciated!


texts:
i am using the views_php module and i need to get the user by his uid to read out some properties to build a filter. (It is not the currently logged-in user!).
Is there some drupal function like this ?

$myuser = drupal_get_user_by_uid(uid);


texts: I have a view on a node page. How do I get it to list all content that has the same author as the current node?


texts: Finding commerce custom fields inside a rules loop

texts:
I have a few custom fields added to line items (so buyers can add specific information for each item they add to their cart.)

I need access to those custom fields using rules. However, I can't seem to get at them inside of a loop.

In order to get access them in the first place, I used "Entity has field", and they show up just fine to use in actions, until I get inside a loop. line-items:... doesn't include those custom fields.

What am I missing?


texts:
I am using drupal 7 with profile2 module, Created a profile type which is not filled up by user at registration time. after a user register they have a option to fill up the page . I need a way to restrict user from editing that custom profile page only if they have already submitted the information. Does anyone know how to accomplish this ?

thanks


texts: Get email address for receiver from node field

texts:
I have site where is +300 different workshop nodes (one conent type). All workshops should have contact form in node page.

Is it possible with Entityform pull email from node field to form receiver email? So that I dont have to manually make +300 contact forms with right receiver email addresses?

Entityform uses Rules to send email. So what I did:

I cloned Email Entityform Submitter and added Node variable to it.
Then added Condition: Content is type of Workshop. And edited Send mail with Variable to set data-selector to node:field-email.

But when submitting form I'm getting this error:

  RulesEvaluationException: Argument node is missing. in RulesPlugin->setUpState() (line 652 of /public_html/sites/all/modules/rules/includes/rules.core.inc).

Any ideas how to make this work?


texts: Pass php variables to js without drupal behaviour

texts:
I stand on the following tricky situation:

I have a node with geofield coordinates attached. I am constructing an array of points. Something like:

Array
(
[86] => Array
    (
        [0] => Array
            (
                [lat] => 39.1641410477
                [lon] => -2.633972168
            )

        [1] => Array
            (
                [lat] => 41.0420738489
                [lon] => -2.633972168
            )

        [2] => Array
            (
                [lat] => 41.0420738489
                [lon] => 1.2524414063
            )

        [3] => Array
            (
                [lat] => 39.1641410477
                [lon] => 1.2524414063
            )
        [4] => Array
            (
                [lat] => 39.1641410477
                [lon] => -2.633972168
            )
    )

[85] => Array
    (
        [0] => Array
            (
                [lat] => 39.1641410477
                [lon] => -2.633972168
            )

        [1] => Array
            (
                [lat] => 41.0420738489
                [lon] => -2.633972168
            )

        [2] => Array
            (
                [lat] => 41.0420738489
                [lon] => 1.2524414063
            )

        [3] => Array
            (
                [lat] => 39.1641410477
                [lon] => 1.2524414063
            )
        [4] => Array
            (
                [lat] => 39.1641410477
                [lon] => -2.633972168
            )
    )
)

I want to pass this to my-googlemaps.js in order to be used by google's init map
Google map is defined as:

my-map:
  header: true
js:
  js/my-googlemaps.js: { }
  https://maps.googleapis.com/maps/api/js?key=my_key&callback=initMap: {type: external, attributes: {defer: true,async: true}}
dependencies:
  - core/drupal
  - core/drupalSettings

my-googlemaps.js:
  console.log(Drupal.settings);
  function initMap() {}

This way I get Drupal.settings undefined, which makes sense I guess.
On the other hanve if I place initMap into a behavior It can not be seen as a callback as defined in googleapis.com before.

Has anyone stumbled with this before? Any idea how to attack the problem?


texts:
I've had minimal experience with Drupal 7, and I am migrating over to Drupal 8.

I was curious as to what the flow of execution is when serving up a basic page in Drupal 8. In Drupal 7, this was considered the bootstrap process.

Is there an equivalent in Drupal 8?


texts:
Entity Registration
Commerce Registration
Drupal 7

Our site connects with Salesforce to input Entity Registration data as Contacts. I'm building in the ability to have users login and have their registration forms prefilled with the data I grab from Salesforce.

I have the data, but the prefill isn't working. Commerce Registration buries the forms a bit, as you will see below in my code example. I decided to step out of using the Salesforce data and just use a static value and try to set it. Both default_value and placeholder do nothing. If I try to touch ['value'] the site crashes.

Here is the trimmed down version of what I have:

<?php
function createFieldMap(){
    $fieldMapping = array(
        "LastName" => "field_last_name",
        "FirstName" => "field_first_name",
        "Salutation" => "field_prefix"
    );
}
function custom_module_form_commerce_checkout_form_registration_alter(&$form, &$form_state, $form_id) {
    $fieldMap = createFieldMap();
    foreach ($form['registration_information']['register_entities'] as $name => $data) {
        foreach($form['registration_information'][$name] as $subname => $subdata) {
            foreach ($fieldMap as $salesforceKey => $drupalMachine) {
                if($drupalMachine == 'field_last_name'){
                   $form['registration_information'][$name][$subname]['field_last_name']['#default_value'] = "Johnston";
                   $form['registration_information'][$name][$subname]['field_last_name']['#attributes']['placeholder'] = t("Johnston");
               }
            }
        }
    }
}

Just to point out, $form['registration_information'][$name][$subname] is valid and is done that way because if you have multiple forms, the productID is used as the form ID, twice. I can access $form['registration_information'][$name][$subname]['field_last_name'] if I var_dump it out. ['value'] represents entity data for some reason, which is probably why it crashes if I try to adjust that.

I can get this to work fine by setting the default_value of select lists. But the text fields don't do anything.


texts: Using Drupal's standard cache system, is there a way to clear the cache for a node or url without clearing the entire cache (which slows down the whole site)?


texts: Content type - field type - Select list: Add options: Existing content on the website

texts:
I want to do something in my website, but I can't figure how. Let me explain:

I have a content type called bananas, and I have created a lot of bananas pages.

I want to create a content type called peaches and add a field with a select list called "Existing bananas on this peach" - and I want to be able to select from all the bananas pages my website has.
Then, if it is not asking too much, I want this field to be a link to the specific bananas page.

Am I making myself clear? For me it's simple, but I don't think there's a way on Drupal to do that. Or maybe there is, but I'm just not seeing it.

Hard or easy, do you have any solution?

Thank you so much in advance, hope you guys can help me.


texts: Site crashes after running 'composer install' to update modules

texts:
My website is running Drupal 8.8.x When upgrading to Drupal 8.9.x and then running 'composer install' on production everything seems to install as expected but the site then goes offline with a 500 error and running any Drush command outputs the below text. I suspect it may be an issue with something in my composer.json file but I have no idea what it could be. I have dozens of other similar Drupal sites and none have this issue.
I've spent a couple of days trying to figure out the cause or a fix without look. Any suggestions?
PHP Warning:  require(/home/WEBSITE/public_html/vendor/composer/../../load.environment.php): failed to open stream: No such file or directory in /home/WEBSITE/public_html/vendor/composer/autoload_real.php on line 73

PHP Warning:  require(/home/WEBSITE/public_html/vendor/composer/../../load.environment.php): failed to open stream: No such file or directory in /home/WEBSITE/public_html/vendor/composer/autoload_real.php on line 73

 PHP Fatal error:  require(): Failed opening required '/home/WEBSITE/public_html/vendor/composer/../../load.environment.php' (include_path='/home/WEBSITE/public_html/vendor/pear/pear_exception:/home/WEBSITE/public_html/vendor/pear/console_getopt:/home/WEBSITE/public_html/vendor/pear/pear-core-minimal/src:/home/ntgitc                                om/public_html/vendor/pear/archive_tar:.:/opt/alt/php73/usr/share/pear') in /home/WEBSITE/public_html/vendor/composer/autoload_real.php on line 73


texts:
I need advice regarding my plans for a Linux/Windows web development project.

My employers have 2 windows servers - one hosts their non-drupal CMS and the other hosts the website database.
My job is to transition their website to Drupal - that's the easy part. So, I will be shutting down the server hosting the current website.

The hard part is using two separate servers for the site and the database - something I've never done before.

I plan on using a Linux server for the Drupal development but I need to know how to do the following:

use a remote database
use SQL Server on a Windows IIS machine


texts: How to add advertisement node at the end of Slideshow

texts:
I have three content type
1) Slideshow
2) Slides
3) Advertisement

While creating slideshow we can assign slides to slideshow with nodereference field.
We have created a views for slideshow on the view page of slideshow we are displaying all the slides one by one and there are two links next and previous.
Now I want to add a single Advertisement at the end of this slideshow view.

I tried hook_views_api() and hook_views_query_alter().
Content type slides and advertisements have different fields.


texts: Is the a module that will allow me to quickly switch from administrator to user?

texts:
Is there a module that will allow me to quickly switch from the administrator view of my site to the user's view?

I currently use Firefox to login as admin and IE to login as a user. This arrangement works, but is very, very slow.


texts: Trigger jQuery "add more" multiple times

texts:
I have a form that I am filling with default values in hook_form_alter. Some of the fields are in a in a field group and I need to trigger the "add more" button using code.

I figured out how to send a value to the jQuery code via $form['#attached']['js']. I thought I could use that value to run a loop in the jQuery to trigger the "add more" as often as necessary but I only see the field group values twice.

For example if there should be four sets of field group values, I will see the first and second one but not the third or fourth. If I click on the add more button two more times I'll see them in the form.

Here is the code in the js file:

(function ($, Drupal) {
  // Custom functions and variables can go here
  Drupal.behaviors.example = {
    attach: function (context, settings) {
      // Put your document's onload code here
      //alert(Drupal.settings.example.clicks);
      for (var i = 0; i < Drupal.settings.example.clicks; i++) {
        //alert(i);
        $("#edit-fgm-node-example-form-group-stuff-add-more").trigger("mousedown");
      }
    }
  };
}(jQuery, Drupal));

This where I attach the js file

function example_after_build($form, &$form_state) {
  // TODO: Stuff!

  $settings['clicks'] = $_SESSION['count_of_items']; //the initial count of times to trigger jquery
  drupal_add_js(['example' => $settings], 'setting');

  // Add our JavaScript file, named after_ajax.js. This file
  // lives in the /js folder inside our module:
  $form['#attached']['js'] = [
    [
      'type' => 'file',
      'data' => drupal_get_path('module', 'example') . '/js/after_ajax.js',
    ],
  ];
  return $form;
}

Any advice on how I could trigger the "add more" multiple times? Or is what I want to do not possible?


texts: How can I redirect a user after adding a node that also added a new taxonomy term?

texts:
I have a content type with a Taxonomy for locations, these locations can be placed inside parent locations (f.ex United Kingdom -> England -> London), and it is set-up such that the end user can add taxonomy terms that do not currently exist when creating this content.

What I would like to achieve is upon creating a node that ALSO adds a NEW taxonomy term, is to redirect the page to the list of terms page so that the end user can categorise the new location appropriately.

Is this possible?


texts: View with contextual filter using a taxonomy reference from a node

texts:
In a view showing for example products (nodes) filtered by a taxonomy term (product type), I can easily set a contextual filter to select the product type term to be displayed.

Is there a way to get the value for a contextual filter in such a view from another node?

Usage example: Using the example above, I have a content type that presents a product type (taxonomy term) in depth with text, images etc. I want to specify a term in a reference field in the product type presentation and have a block that displays all product for the selected term.

Is that type of filter possible?
I am guessing the same approach can be used in D7 as well as D8 if possible without using third party modules.

If my question is unclear I will be happy to elaborate my case further.


texts: Display different content on node pages depending on user role

texts:
I have a list of items visible for all anonymous user and authenticated user. Then when the user click through, if the user is anonymous, I want to tell them, "sorry must be authenticated". But if they are already authenticated I want to show them the node.

I am using:

if($logged_in) {
   //display node
}

In my node--mycontenttype.tpl.php. How do I make this work?


texts: Multiple Node Variants with Different Paths

texts:
I have my node content type set up using Page Manager. I have different variants for this content type that pass different arguments to my view.  Is there any way to have these variants have different URLs? For example:

my/node/path
editors/my/node/path
retailers/my/node/path
my/node/path/anotheridentifier

The content will be different so I don't see an issue with SEO.


texts: Files folder changes permissions randomly

texts:
It seems that the sites/default/files folder of a project looses the permissions from time to time - and I have no idea how it comes. Suddenly error logs appear stating that the public files folder does not have the correct permissions which is true: it changed from 775 to 755 so that it is not possible any more to upload files.

Does any one has an idea what can cause this issue?


texts: Migrating a Drupal Node.js website from localhost to web server

texts:
Due to specific website feature requirements, which do not seem to be possible in Drupal 7 without Node.js integration, I am strongly considering to integrate Drupal 7 with Node.js modules offering real time interactivity. I understand the basic concepts however I have never actually used Node.js on a website before. I have installed Node.js on my computer under Program Files (Windows) and begun testing the integration with a test website on localhost (WAMP).

My concern is for when I later will need to migrate a client's website to an actual web server. I would like to ask those who have had some experience with such Drupal/Node.js integration, what is a streamlined workflow for migration. For example, I am wondering if Node.js should be installed into the same folder as the website directory instead of Program Files, so that when testing is finished I will be able to ftp the entire website directory with the Node.js installation without needing to reinstall Node.js and reconfigure everything. I am not sure if copying everything over would work or if Node.js needs to be installed again separately on the web server?

I would like to get a clearer understanding of this process before I make the leap into Node.js integration with future client websites. I believe Node.js integration introduces some great new features however it could potentially be a giant can of worms if not handled properly.


texts:
I'm trying to replace the upload and remove buttons in a webform file upload widget with visual icons.

I'm having trouble for a number of reasons but the most confusing is this:

I don't see where in the markup the "Browse..." and "no file selected" text is coming from? I've tried altering the $variables['element']['upload_button']['value'] in hook_preprocess_webform_element and I didn't see any change in the value of the button or description.

If I remove type="file" and change the type to text, the "no file selected" note disappears too.

I have no idea what's going on.

For reference here's what I'm going for (left is after file upload, right is before file upload):

I'm using Drupal 7, Webform with Civicrm, and AutoUpload.


texts: Conditional rewrite on views according to singular / plural

texts:
I am building a website using views and the answer module.

In my view, I add "Content: Answer Count" which is the number of answers.

I want to be able to rewrite the following output:
(1 Answer)
(2 Answers)
(3 Answers)
...

I know how to output "(no answers yet)" when the count=0.
But, how can I differentiate between singular and plural and output "Answer" or Answers" according to the count?


texts: Is it possible to add menu tab in any menu group?

texts:
Any idea on how I can render the menu tab item into a menu group?

My goal is to add a user tab in navigation menu group. I tried hook_menu but I cant manage to make it work.

Here's my approach:

function lms_core_menu() {
  global $user;

  $items = array();
  $items["user/$user->uid/myresults"] = array(
    'title' => 'My Results',
    'type' => MENU_NORMAL_ITEM,
    'menu_name' => 'navigation',
  );

  return $items;
}

Ideas will be greatly appreciated.

EDIT: See the image attached.


texts:
Is there a way to print out an array of the entirety of a menu in Drupal 7?

For example, I have access controls in place so that a user gets a role after they take a quiz, which then allows them to see the next quiz. So until they pass quiz #1, their menu will not show them any evidence of quiz #2's existence.

What I want to do is print out the titles of ALL menu items, regardless of whether the user has access to the associated nodes or not. I plan to rewrite the menu to make the permitted items links, while the others appear greyed out until the user gains access to them.

I have not been able to find any modules, and simply doing this:

print_r(menu_navigation_links('menu-program-menu'));

only shows the items that the user has permission to view.

Is there a module already that does this, that I just haven't been able to find? Does a query have to be made directly to the database or is there a way to do this with more finesse?


texts: Blog entries and blog listing page are different content types?

texts:
So I've noticed that Drupal sets the blog listing page as a different content type to the blog articles. This is a bit awkward because I want to set blocks that are specifically for the blog section.

In admin I can choose to restrict by content type: News Articles (the blog entries), or choose the pages on which the block displays displays: so list the page /blog which is the Blog listings page.

How can I have harmony and set a block for blog listing and blog entry pages excluding the rest of the site?

Thank you


texts: "File not found error" when installing using composer

texts:
I'm running Docker on Ubuntu 18 with a container for MariaDB, Nginx and php-fpm (7.3).
The PHP container has composer installed, and I used it to create a Drupal Commerce project. I can start the Drupal install process using a browser, but after I input the DB settings, the process fails and I get the following error.

  An AJAX HTTP error occurred.
  HTTP Result Code: 404
  Debugging information follows.
  Path: /core/install.php?profile=commerce_base&langcode=en&id=1&op=do_nojs&op=do
  StatusText: Not Found
  ResponseText: File not found.

Increasing the execution time, post time, memory limit, post and upload sizes in the php.ini file, as recommended by another user, didn't solve the problem.

Nginx error log contains the following message.

  [error] 6#6: *46 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream'.

The database has tables and data in it, so I know the database credentials are correct.

What am I doing wrong?


texts: is there any possible conflict for fields with the same machine name?

texts:
i am trying to debug a paragraph not displaying fields and i am having

  /admin/reports/fields

a same machine name for a field in 3 different paragraphs

field_call_to_action_ref    paragraph   Entity reference revisions (module : entity_reference_revisions)

    Bloc compositeParagraphe standardElement d'accordéon


texts: How to make Drupal upload pasted links to .doc files from the internet

texts:
Let's say I have a Drupal website and I want there a function that would work like this:
Paste an URL to a .doc file, so on submit Drupal downloads that file, uploads to its local server and generates a link to download from the website.

I was wondering if this needs custom coding or can this be achieve with a module?


texts: CSS styles not working while included in .info.yml file

texts:
For some reason my theme can't find css/style.css in Drupal 8.

This is the .info.yml:

name: Adminimal
type: theme
description: Drupal Administration Simplified.
# version: VERSION
# core: 8.x
base theme: seven

# Include CSS.
 stylesheets:
  all:
   - css/style.css

# Information added by Drupal.org packaging script on 2014-10-23
version: '8.x-1.x-dev'
core: '8.x'
project: 'adminimal_theme'
datestamp: 1414059738

This is how the folders look like:

Theme/adminimal.info.yml
Theme/css/style.css

The css in the style.css file:

html{
    background-color: blue !important;
}

It doesn't even show up in the styles section in my Google Chrome console so I think it doesn't find the file but why?

And about jQuery in Drupal, I can't manage to get this working: https://www.drupal.org/node/1541860 To work with: //ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js How should I do this?


texts:
I have a custom get resource API. The resource working fine. Whenever I clear cache, resource doesn't work and show error.

  The controller result claims to be providing relevant cache metadata,
  but leaked metadata was detected. Please ensure you are not rendering
  content too early.

I follow some topic and edit code like this

$build = [
  '#cache' => [
    'max-age' => 86400,
    'contexts' => [
      'url.query_args',
    ],
    'tags' => [
      'http_response'
    ],
  ],
];
$res = new ResourceResponse($response, 200);
$res->addCacheableDependency($build);
return $res;

or

$res = new ResourceResponse($response, 200);
$res->getCacheableMetadata()->addCacheTags(['http_response']);
return $res;

but still error. Please help!

Update

After debug. I fixed $response.

$response = [
  'total' = '10',
  'comment' = 'comment'
];

And comment some line code.

$field_definition = $node->getFieldDefinition('field_event_comments');
$mode = $field_definition->getSetting('default_mode');

$storage_comment = \Drupal::entityManager()->getStorage('comment');

$comments = $storage_comment->loadThread($node, 'field_event_comments', $mode);

Update 2
Create new simple rest resource with code:

$comment = Comment::load(387);// comment id exited
return new ResourceResponse('data', 200);

Error don't show. When uncomment error show again.


texts: How can I avoid extraneous divs in my form?

texts:
When I create a form using the form API, the resulting html includes all sorts of unwanted divs. For example, if I use:

$form = array(
    'myFieldset' => array(
        '#type' => 'fieldset'
    )
);

The resulting html looks like this:

<form action="/drupal-7.15/?q=chercheur" method="post" id="form-chercheur" accept-charset="UTF-8">

        <fieldset class="form-wrapper" id="edit-myfieldset">

        </fieldset>
        <input type="hidden" name="form_build_id" value="form-87Dv5ezVpaLI5mD345ofMkLgPhsv_dawudUp73ePQTc" />
        <input type="hidden" name="form_token" value="sXXINWr7rmParm0tRJoEb6QKGIH_QH-ffRSOtnvxYY0" />
        <input type="hidden" name="form_id" value="form_Chercheur" />

</form>

As you can see, two extraneous divs are added here. They are making the javascript I'm writing uselessly complicated, so I was wondering if there was a way to remove the extraneous divs. Ideally, I would like to obtain something like this:

<form action="/drupal-7.15/?q=chercheur" method="post" id="form-chercheur" accept-charset="UTF-8">
    <fieldset class="form-wrapper" id="edit-myfieldset">
    </fieldset>
    <input type="hidden" name="form_build_id" value="form-87Dv5ezVpaLI5mD345ofMkLgPhsv_dawudUp73ePQTc" />
    <input type="hidden" name="form_token" value="sXXINWr7rmParm0tRJoEb6QKGIH_QH-ffRSOtnvxYY0" />
    <input type="hidden" name="form_id" value="form_Chercheur" />
</form>

Is this possible?


texts:
Another developer has left me a non-functional page inside a module with a lot of dependencies tied to $user_profile, which does not exist in the scope of this module. Is there a way I can use $user_profile (which arguably has the calls necessary) over having to make changes to make $user (which does work, strangely) on this page?

This is the code block that loads the template in question. The rest of this module is basically a hook_menu overload with aforementioned methods. No other calls are made to $user_profile here.

function generic_user_player_messages($usernumber) {
  global $user;
  $userID = $user->uid;

  if (is_numeric($usernumber) && ($account = user_load($usernumber)) && ($userID == $usernumber) && (in_array('member', $user->roles)) || (in_array('administrator', $user->roles))) {
    return theme('generic_user_player_messages');

  } elseif ($userID != $usernumber) {
      return array(
        '#type' => 'markup',
        '#markup' => t("This is not the profile you are looking for"),
      );

  } else {
    return drupal_not_found();
  }
}

And a segment of the code from the .tpl.php

        <?php
        //dsm($user_profile);
        //dsm($user);

        $user_picture = render($user_profile['user_picture']);
        if (strlen($user_picture) > 0) {
            print render($user_profile['user_picture']);
        } else {
            ?>

        <?php }
        ?>


texts: How can I manage and track the patches (functionality new and old) to the modules and sub-modules of my project in an Organization?


texts: Trouble with session ID and Drupal cookies when trying to establish a connection with Service Module and http-post

texts:
I am trying to complete an http-post between my common lisp application and my Drupal Site running Services and a Rest server.  Currently I have my rest server set up to accept user login, and using Poster (Firefox plugin to create http requests) I am able to connect to my rest server.  Also, using Poster  if I am currently logged in I get a response "406 Not Acceptable: Already logged in as.." and if I am not logged in I get "200 OK" and when I go back to my browser I am logged in to my Drupal site.

Now I have been trying to simulate this same behavior using an http-post from my lisp application and I have been having a lot of trouble.  For a long time I was always getting "200 OK" if I had correct username and password in the body of my post looking something like this:

username=ender2012&password=password&form_id=user_login

but it would not actually login and if I was already logged in I would never receive the 406 response that I expected.  Finally I downloaded HttpFox which showed me the actual post that Poster was sending and I noticed that Poster was sending a Cookie header that looked like this

Cookie: Drupal.toolbar.collapsed=1; CAKEPHP=10e32669174a611c8919eeff471a2a1c; Drupal.tableDrag.showWeight=0; has_js=1; SESSdc0685ed01f285dab628a3700259e6bc=3qqK5XPaLRhEx7o4wAbIq5qK9qHEzRxz5qUnYZsaXG0

Now if I add a Cookie header to my lisp application's post with the Cookie I saw in http-post from Poster and I am logged in, I will get the 406.  So it seems that there is some sort of session information stored in this cookie that I will need to use for my lisp application but I am unsure about how this would all work inside my application.  Could anyone help me understand all of this?

Details:

• I am running Drupal 7

• I am using Services 3.0

• I am using a rest server with session authentication

• I am using application/x-www-form-urlencoded

• I am running this server on MAMP localhost currently


texts: output raw text for Javascript CDATA use

texts:
I've created a content type with coordinates data for a bunch of projects we're running. I want these coordinates to be output raw into a CDATA block, so that I can mark each project on a Google Map.

Output should look something like this:

  ['Son La',21.335432,103.908691,'1. AFLI2. Gender-specific
  appreciation of land use and landscape multi-functionality'], ['Dien
  Bien',21.42239,103.029785,'1. AFLI'],

Unfortunately, my view always includes all kinds of <div> elements that obviously break the data format. I can't seem to find where I would set the output to be raw, i.e. without any formatting, and allowing me to use [ and ]. Maybe I don't have the right permissions?


texts: Best way to place hard coded link in template in multi lingual drupal 8

texts:
My website (drupal 8) was first in one language. Now I switched to multi langual.

Most of the settings i did find (translate content, webforms, strings,...).

But at the moment stuck on the hard coded links I use in the template (theming).

So I'm looking for the best way to let my hard coded links work for more languages.

At this moment this is what i got (and ofcourse this is not working well):

{{ 'DIENSTEN ON SITE'|t }}

This link doesn't bring the visitor to the correct link (en/ or fr/ is missing). Translate on the string works already :).

My current settings for detections are visible in the image:

Thanks for reading!

Kristof


texts: How do I integrate a Media library to Image Field?

texts:
I have a image upload element field in my content type. I need to open a media library when I click on browse. My expectation is to select an image which I have already uploaded before. So I don't have to upload the same image again and again.

I've searched but I couldn't find a module for media library in Drupal 8. They are saying it is in the core of Drupal 8. I couldn't find it too. Is there an easy way to do this? Simply what I wanted is a library like in the image.(this is the media library in wordpress)


texts: How to add body class that carries the menu depth of the current page?

texts:
I am on Drupal 7. On the body tag, I need to create a new class that will detect the current page's menu depth. The class could carry the ID of the menu, then something that would detect the current page's menu depth. It could be something like: "primary-depth-0" for the top menu items, then "primary-depth-1", "primary-depth-2" and so forth... Is it easy to code that on template.php? I assume I have to add a new item into the $classes array...

Thank you.


texts: need to print current row position number in block for most popular article

texts:
I created a view mode named "small-sidebar" and here I need to print current row position number in this block...

I'm using this code :

        <?php echo $content['small_image']; ?>

        <?php echo $label; ?>

      <?php echo $content['title']; ?>

        <?php  echo $content['read_more_link']; ?>

    <?php render($node); ?>

but it not show the current position

in the div class lebel-no I need to print the current position


texts: Display date field labels within selectors

texts: Is there a way to move the labels of the day/month/year components inside the selectors (like Facebook has it on their registration page, see 'Birthday')? I have placeholders in all my text fields and it looks silly that the labels of date fields sit on top.


texts: Create dynamic page with dynamic addresses

texts:
My module creates pages. These pages have dynamic addresses, such as:

test -> http://www.SITENAME.com/test or
hello/world -> http://www.SITENAME.com/hello/world or everything that admin adds.

How do I assign a page callback to these pages? I get the "page not found error" on these pages.

I am using Drupal 7.


texts: In Views, how can I show a blank end date if no value is entered?

texts:
A date field in views allows you to show a start date and/or an end date. If the end date is optional, and not filled out by the user, views doesn't show a blank field if it is empty-it's show the start date for some reason.

This issue is similar to How can I rewrite a date field "End Date" to be "present" if no value is entered?

I have tried messing around with the code in the above issue to meet my needs but it's not working.

I have views php installed and I need to add php code to show the field label and date but leave the date portion as blank, if empty. e.g. End Date: 2017-09-20 or if empty End Date:

These are my available variables

$row->field_start_date: Content: Position start/end date (Set to display only start date)

$row->field_start_date_1: Content: Position start/end date (Set to display only end date)


texts: Using the web interface or using Drush cause different result?

texts:
What is the difference executing an upgrade from Drupal 6 or 7 to Drupal 8 using the web interface or it's better to use Drush?

If the database is heavy, using either of them would have different result?


texts: Override core files database, statement, connection

texts:
I'm trying to turns things in everyway in order to override those core files: Database, Statement & Connection in order to build a simple array of SQLQueries along with their results in order to intercept some weird mess into my website ..
#module.services.yml
services:
  module.database:
    class: Drupal\module\Database\Connection
    factory: Drupal\Core\Database\Database::getConnection
    arguments: [default]

Sadly I find no other way than editing core files in order to perform this, has anyone some clever Idea ?  There is the _query_alter hook, but not getting any hook like fetchCol, results etc ..


texts: How to configure access for creating a custom LMS?

texts:
I am looking to create a LMS either in an existing Drupal install.

Anonymous users can browse course information and also preview certain Modules & Slides (see below). They will be able to buy access to a Course and then view the all the Course content. There will be a multiple different Courses, each need to be purchased separately at different prices.

Course hierarchy:

Course > Module(s) > Topic(s) > Slide(s)
Course is what the user will pay for access
Modules and Topics are the only for categorisation and may only have a Small description
Preview content will be by only a select few Modules per Course - being able to see the slides within chosen module
Slides are where the learning content is - mostly videos and PDFs
Slides may also be a Quiz

Once purchased, the display of the course content will be with the full course hierarchy in a sidebar so the user can navigate through the course and view the content of each slide in the main content panel by selecting the Slide.

Question: There are a few choices out there, however I have seen posts about Organic groups. Is this the best way to categorise the Course Content, or should I use Taxonomy? (As the how user view the course information will be with the full Course hierarchy in a side bar and selecting Slides will show the Slide content in the main section)

I am very familiar with Drupal basics, but I would like to know how to restrict user access to only their own purchased content?

What would be your solution to set this up?


texts: Strict warning and views - site not working

texts:
I am using drupal 6 and after moving to php 5.4 or 5.5 from 5.3, I am getting error "strict warning: Declaration of views_plugin_style_default::options() should be compatible with views_object::options() in.... views_plugin_style_default.inc on line 24."
I tried updating views but does not help. It is not just about warning - Views do not work at all. What can be done in this case? Besides switching to 7.x - it is not an option for me. Thank you.


texts: How to get the users who did not submit articles?

texts:
Every day people are expected to post 1 node of content type "Article" on my site. If they missed to post such article, then I need to somehow produce a message "Your article is pending" to those users.

Additionally, I need to be able to check which date a user did not submitted such article.So how can I get all users who did not submit articles? And also filter them on which date they have missed the submission of an article node?


texts: How to I place the create form for content type on a page that can save the user's id?

texts:
I'm new to Drupal. I've created a content type and I've created a view (using the Views module) to display the data.

I can add data from Content > Add Content > Item, which gives you a Drupal admin form.

How do I place this form on a page that can save the user's id?


texts:
I want to alter the view query before rendering the view, so I use the hook_views_pre_execute. I want to add an 'WHERE' 'AND' condition clause to the query. So here is my code :

MYMODULE_views_pre_execute(&$view) {
    // some code here to get my node id to exclude
    $view->query->add_where('1', 'node.nid', $nid_exclude, '!=');
}

but it seems to me the hook not working, or I did mistake to the add_wherefunction?

UPDATE : The hook is executed but the view is not modified.


texts:
I was wondering if anyone had any tips for use a GET call with ajax forms instead of POST?

One of our ajax calls is returning some JSON that we want to be cached in the browser.  If we can switch the call to GET then that caching will happen for us.


texts: Problem in dependency injection in drupal custom module service

texts:
I face with a problem in defining service in drupal 8.0
my service is :

services:
  tracking.middleware:
    class: Drupal\mkt_tracking_v2\Middleware\TrackingMiddleware
    arguments: ['@kernel','@config.factory','@request_stack']
    tags:
      - {name: http_middleware, priority: 1000}

the problem is: the object that passes to TrackingMiddleware aren't based on the arguments definition.

as I get this error :

  Thu Apr 04 01:51:23.919189 2019] [php7:notice] [pid 28435] [client 127.0.0.1:51962] TypeError: Argument 2 passed to Drupal\mkt_tracking_v2\Middleware\TrackingMiddleware::__construct() must implement interface Drupal\Core\Config\ConfigFactoryInterface, instance of Drupal\Core\DrupalKernel given, called in /home/hossein/Project/Drupal/8.7/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 274 in /home/hossein/Project/Drupal/8.7/web/modules/Marketing/mkt_tracking_v2/src/Middleware/TrackingMiddleware.php on line 41 #0 /home/hossein/Project/Drupal/8.7/web/core/lib/Drupal/Component/DependencyInjection/Container.php(274): Drupal\mkt_tracking_v2\Middleware\TrackingMiddleware->__construct(Object(Drupal\Core\StackMiddleware\NegotiationMiddleware), Object(Drupal\Core\DrupalKernel), Object(Drupal\Core\Config\ConfigFactory), Object(Symfony\Component\HttpFoundation\RequestStack))\n#1 /home/hossein/Project/Drupal/8.7/web/core/lib/Drupal/Component/DependencyInjection/Container.php(171): Drupal\Component\DependencyInjection\Container->createService(Array, 'tracking.middle...')\n#2 /home/hossein/Project/Drupal/8.7/web/core/lib/Drupal/Component/DependencyInjection/Container.php(480): Drupal\Component\DependencyInjection\Container->get('tracking.middle...', 1)\n#3 /home/hossein/Project/Drupal/8.7/web/core/lib/Drupal/Component/DependencyInjection/Container.php(230): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array)\n#4 /home/hossein/Project/Drupal/8.7/web/core/lib/Drupal/Component/DependencyInjection/Container.php(171): Drupal\Component\DependencyInjection\Container->createService(Array, 'http_kernel')\n#5 /home/hossein/Project/Drupal/8.7/web/core/lib/Drupal/Core/DrupalKernel.php(1412): Drupal\Component\DependencyInjection\Container->get('http_kernel')\n#6 /home/hossein/Project/Drupal/8.7/web/core/lib/Drupal/Core/DrupalKernel.php(693): Drupal\Core\DrupalKernel->getHttpKernel()\n#7 /home/hossein/Project/Drupal/8.7/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))\n#8 {main}, referer: http://drupal.local/admin/modules/uninstall

  but as i define the class in this way the constructor parameters is right :

 public function __construct(HttpKernelInterface $app,ConfigFactoryInterface $configFactory,RequestStack $requestStack) {
    $this->app = $app;
    $this->configFactory = $configFactory;
    $this->requestStack = $requestStack;
  }

did I do any mistake in service definition?


texts: Is there a good reason to prefer one method of installing over another?

texts:
Starting to play around with drupal 8.  My first method of installing was installing drush8 (as mentioned in https://www.drupal.org/documentation/install/download):

Get drush8:

composer require drush/drush:dev-master

and then

drush dl drupal
mv drupal-8.0.1/* .
mv drupal-8.0.1/.* .
rmdir drupal-8.0.1

Then I later read that instead of installing via drush I can install via composer (Using Composer in a Drupal project).  The earlier drupal instructions that I read above had no mention of this installation method.

composer create-project drupal/drupal my_site_name 8.0.*`

I also found a slightly different variation (Composer in relation to Drush Make):

composer create-project drupal-composer/drupal-project:8.x-dev some-dir --stability dev --no-interaction

Which I understand creates a slightly different directory structure (according to this article it also creates a 'web' sub directory).

There's also the Drupal Console method:

drupal site:new my_site_name

Other than personal preference, is there a good or valid technical reason to use one method over another?


texts: Hi I have a webform which user will fill and get a confirmation link.On clicking the confirmation link the user is a confirmed user.I want an add on functionality of admin approval in it so that after the admin approval the approved user name is displayed in a list.Any help please.Thanks in advance


texts: Allow users to use embedded HTML tags in custom blocks

texts:
I'm using CKEditor in Drupal 8 and the client wants to write HTML that contains embedded tags like so

<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">

</button>

Unfortunately, Drupal ends up mangling the code to something like this

<button aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation" class="navbar-toggler" data-target="#navbarSupportedContent" data-toggle="collapse" type="button"></button>

&nbsp;

<button aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation" class="navbar-toggler" data-target="#navbarSupportedContent" data-toggle="collapse" type="button"></button>

I think this is in an attempt to prevent XSS but I'm not totally sure.

Should I be able to allow the user to embed tags? If so, how could I go about doing this?


texts: How do I set meta tag information in a view display based off the contextual filter?

texts:
I have a display in a view (page) which uses a taxonomy term id as a contextual filter to choose what content to display. I need to be able to change the meta tag based on the value of the taxonomy term id.

Our site is currently using the meta tag module, but I believe that this only lets me set generic meta tag information that will appear exactly the same on a page using this display. Can this module handle this problem?


texts: How to create different Filter Criteria which works indipendently for every views (one is "For All" the other is "For this page")

texts:
I will post down an image I edited to better help you understand what I'm asking for

The reason is I've more than 50 different views that filters the same objects from a single content type based on their personal taxonomy term that differentiates them in some sub-categories, but I want those views to also have a common filter for the Year in which they were created (for development reasons, the year is a taxonomy term with just a number like "2018" "2019") so that when I want the users to view the content created this year (2019) I just have to modify one filter criteria and update it for everyone else. Currently you can only have a single filter criteria section which can either be "for all" or "for this page", this means I've to manually change the year filter for all 50 of them because I need filter criteria to be Overriden in every single view to introduce a filter for each sub categories.
Is there a solution to this? a module? Or were can I find the PHP code which regolates how filters works?


texts: Change layout of views page based on taxonomy term field

texts:
I have a taxonomy term page being displayed via a Views 'page' display. I need to change a value in the header of the site (above the level of the view) based on the value of one of the fields in the taxonomy term.

The problem is that I can't find the right hook for this. If I hook into hook_preprocess_views_view, it's too late. The wrapper that includes the site header has already fired. If I try to run hook_preprocess_page, there isn't yet any information in the $variables arg to give me the taxonomy ID so I can look up the field value. Unless there is are variables available to the hook in addition those that are passed into function as args, I don't see how I can get the requisite information. Are there other variables I could use that are undocumented or global variables available that just aren't passed to the function/hook?


texts: Setting up responsive content within a responsive theme

texts:
I want to make a layout INSIDE the main content which is responsive.
I've read through dozens of pages, watched several videos and still there is no clear path to acomplish resposive content.
I started out with the latest Zen, but Display Suite and Panels let me place my fields in different grid layouts, but these grids end up not being responsive.

I now installed Omega, ending up having the same issue.
So, which theme and which modules let me setup a responsive grid WITHIN the main content?


texts: Entity Reference - show link on referenced node

texts: I have a "Entity Reference" field in a custom content type. I want to show on any referenced node the link to the node. How can I do it?


texts: Regarding content slider on mobile screen

texts:
I am trying to make a Drupal 7 desktop site into a responsive one. There is a view of type node listing the node title and image in a grid format on front page. I want that on the mobile screen instead of a grid it just becomes a list of horizontal fields and can be navigated by touch (maybe act as a slider). Any leads how to proceed.

Please shoot out if you need any more info. Would really appreciate any suggestion.

Thanks


texts: How do I build custom options for sections?

texts:
I manage to build/define some custom blocks with my own parameters/form elements when placing them, so I'm looking to do the same with sections. I've seen that the core code does that, but ideally I would like to add more form elements to that interface and allow the editors to customise a bit more the abilities of each section. I found the core file that contains the functions but doesn't feel right to me to just copy the whole file and modify it for my purpose.
I also found this module that seems that does what I'm after but has some issues I think.
I made a layout module in order to define some basic layouts (4 of them) and now I'm trying to do the above. The code is as follow:
hs_layout.module file
/**
 * Implements hook_form_alter().
 */
function hs_layout_form_layout_builder_add_block_alter(array &$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  $form['settings']['admin_label'] = [];
  $form['settings']['label'] = [];
  $form['settings']['label_display'] = [];
}

/**
 * Implements hook_form_alter().
 */
function hs_layout_form_layout_builder_update_block_alter(array &$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  $form['settings']['admin_label'] = [];
  $form['settings']['label'] = [];
  $form['settings']['label_display'] = [];
}

HsOneColumnLayout.php file
namespace Drupal\hs_layout\Plugin;

use Drupal\Core\Layout\LayoutDefault;
use Drupal\Core\Plugin\PluginFormInterface;

/**
 * Class HsOneColumnLayout.
 *
 * @package Drupal\hs_layout\Plugin
 */
class HsOneColumnLayout extends LayoutDefault implements PluginFormInterface {
}


texts: Display field from referenced entity using Display Suite and Views

texts:
I have a view which displays some products (node) teasers.

In the products, I can select a producer (taxonomy term).

Now... In the products teasers I want to display the country, which is a field from the producer taxonomy term. How can I add this field to the teaser using Display Suite?


texts: How can I evaluate the security of a contrib module?

texts:
Are there security standards for each stage of a module on Drupal.org?

  Create sandbox project > full project with dev version only > official release

What is the process for the security of contrib modules? Do audits happen?

Historically, I have functionality rather than security on my mind when selecting a contrib module. Partly because I don't know how to easily evaluate security (that is, without studying the entire code). How can I evaluate how secure a contrib module is?


texts: Multi-lingual comments translation only appears on source language post

texts:
I am seeking a patch for Drupal commons to fix an issue with comments to a post not appearing on the translated post as a thread.

So, in simple terms, on the original language post all comments appear. On the translated post no comments appear. I have searched but found nothing so far.


texts: How to add image field to main navigation menu item

texts:
I am having a problem using MYTHEME.theme file to add image field in the menu item object. I need to be able to specify an image for each menu link/item!

function HOOK_entity_base_field_info(EntityTypeInterface $entity_type) {
  $fields = [];

  if ($entity_type->id() == 'menu_link_content')
  {
   $fields['menu-image'] = BaseFieldDefinition::create('image')
   ->setLabel(t('Image shown next to menu name'))
   ->setComputed(TRUE);
  }
  return $fields;
}

I don't think that this code actually runs, I cannot see any effects!


texts: Boost crawler - maximum time to use for crawling on every cron run?

texts:
I have a drupal 7 site. The site is really big and has few content types, and a lot of content.
I use boost and Cache expiration to improve performance.

I will be happy to get some information regarding the crawler of Boost.
I want to Pre-cache as much pages of the website as I can, so they get cached before anyone accesses them.

what is the maximum recommended time (in seconds) to use for crawling on every cron run?


texts: How can I safely move a module to another folder?

texts:
I created a module through Drupal Console, unfortunately it wasn't placed in a folder of its own, rather straight into /modules/custom. Before I noticed where it had gone, I enabled the module.

In Drupal 6/7, this was easy to fix - I could literally just put the files into the correct path, clear the cache (maybe rebuild the registry, it wasn't an exact science), and all was well.

The same isn't true for Drupal 8; I moved the files into a subfolder, rebuilt cache, and all requests tell me that Drupal is failing to include a required file. The particular file is a block class, and the path Drupal is trying to find it is where it used to be, not where I've moved it to.

The bit of code objecting is in Symfony's ApcClassLoader, so I guess I need to clear something that's slightly above Drupal's head to get this path reference updated.

How can I do that?

Uninstalling and re-installing the module does work, but once there's important data stored that's not going to be an option.

I was wrong, uninstalling and re-installing is not a viable option. After uninstalling and reinstalling, Drupal can no longer pick up the custom blocks the module defines. I'm guessing that reference is cached somewhere that isn't cleared when the module is uninstalled. Just need to find out where that is and how to clear it...


texts:
Our drupal frontend site is running on www.examples.com and admin section is runnning on www.examples.com/admin
Now we have a requirement to access admin using subdomain like admin.examples.com

We tried virtual host following ways

<VirtualHost *:80>
    ServerName admin.examples.com
    DocumentRoot /app
    <Directory "/app">
        Options Indexes FollowSymLinks
        AllowOverride all
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerName examples.com
    DocumentRoot /app
    <Directory "/app">
        Options Indexes FollowSymLinks
        AllowOverride all
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

But no luck.
How we will achive this?
Please help us.


texts: Is there a field tpl for body and/or title fields?

texts:
I need to add some data- attributes and I am hoping to change it for the body and title fields on article content types. Do the title/body have tpl's that I can modify to add these? Or another method I could try? I've tried adding a field--body--article.tpl.php and it doesn't appear to work.

NOTE: This needs to be done in PHP as the search engine we're using needs it to be done server side.


texts: How can I use jCarousel with swipe event in drupal for touch screen?

texts: In my project, I used the jCarousel module and View slideshow module for my items.When I tested with mobile devices,I saw there is a problem for navigation. I can't scroll well . So I would like to add some script for this problem.I already added some script for My View SLide Show from this website (https://gist.github.com/eristoddle/5011106). Fortunately , it works well with View Slideshow but it not works with jCarousel. I need to know which script is appropriate with my problem. Please let me know how can I do? Thanks in advanced.


texts: Set Custom Form Element Value in Extended LinkWidget Class

texts:
I have a class extending LinkWidget and would like to add a new form element.

I have omitted all code except what I have added:

class CustomWidget extends LinkWidget {

  public static function defaultSettings() {
    return [
      'placeholder_field_name' => '',
    ] + parent::defaultSettings();
  }

  /**
   * {@inheritdoc}
   */
  public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {

    $element['field_name'] = [
      '#type' => 'textfield',
      '#title' => $this
        ->t('field name'),
      '#placeholder' => $this
        ->getSetting('placeholder_field_name'),
      '#default_value' => isset($items[$delta]->field_name) ? $items[$delta]->field_name : '',
      '#maxlength' => 255,
    ];

    return $element;
  }

  /**
   * {@inheritdoc}
   */
  public function settingsForm(array $form, FormStateInterface $form_state) {
    $elements = parent::settingsForm($form, $form_state);
    $elements['placeholder_field_name'] = [
      '#type' => 'textfield',
      '#title' => $this
        ->t('Placeholder for field name'),
      '#default_value' => $this
        ->getSetting('placeholder_field_name'),
    ];
    return $elements;
  }

   /**
   * {@inheritdoc}
   */
  public function settingsSummary() {
    $summary = [];
    $placeholder_field_name = $this
      ->getSetting('placeholder_field_name');
    if (empty($placeholder_field_name)) {
      $summary[] = $this
        ->t('No placeholders');
    }
    else {
      if (!empty($placeholder_field_name)) {
        $summary[] = $this
          ->t('field name placeholder: @placeholder_field_name', [
          '@placeholder_field_name' => $placeholder_field_name,
        ]);
      }
    }
    return $summary;
  }

}

The form element exists but is not being set, so I cannot save and access any values from the textfield. Maybe more accurate, the form element does not appear in kpr($items[$delta]).

Can I get this form element to set its value to the form settings?


texts: How to render field attribute in foreach

texts:
I have a link field with multiple values. I want to display the link title for each of these fields. I can print the slide link titles individually but not using the foreach.

Currently I have:

<?php $slideshow_counter = 0;
    $slide_link = $node->field_slideshow_link;
    print $slide_link['und'][0]['title'];
?>
<?php foreach ($slide_link as $link) : ?>

<?php print $link['und'][$slideshow_counter]['title']; ?>

    <?php print $slideshow_counter; ?>
    <?php $slideshow_counter++; ?>
<?php
if ($slideshow_counter == 4)
    break;
endforeach;
?>


texts: Drupal Common's 3 How To Edit The Commons Browsing Widget Tabs?

texts:
In Drupal 7 Common 3

Browsing Widget Tabs
https://drupal.org/project/commons_bw

Want to remove the Wiki's Tab
How can I do this please?

Many Thanks for your help


texts: How to create suggestions conditionally (by block type/bundle) override system templates in Drupal 8

texts:
For example, I want to override image template (image.html.twig) to change how it outputs images from

to

But I require to override only those images, that are rendered inside specific block type (called "bundle" in Drupal terms) b_partner_images.

There is a hook_theme_suggestions_alter(array &$suggestions, array $variables, $hook) hook, that allows to create suggestions based on some conditions, but the problem is that $variables does not contain anything more than image tag attributes - no objects or identifiers, so I see no way to create condition based on some identifiers or block (bundle) name.

How to create file name suggestion for system templates (such as image) to override image output based on block type or any other identifier?


texts:
for example I have a url like:

/node/add/feature

when I go there as guest, I get 'access denied', the access should be changed in the code or in the admin panel? but how can I find the exact place where to make changes by following this url?


texts: Calculated field returns undefined index

texts:
I'm trying to average all of the fivestar ratings I have for a node using a computed field. But i'm struggling to simply access the other fields using entity!

In the body of the node, this works fine:

$test1 = $node->field_ae_stimclasswrk[und][0]['average'];

In the computed field area, this doesn't work:

$entity_field[0]['value'] = $entity->field_ae_stimclasswrk[$entity->language][und][0]['average'];

Instead, when I save the node, I get this index error:

  Notice: Undefined index: und in eval() (line 2 of...

It must be something syntax, but I'm completely out of ideas.

Here is the field info:

    [field_ae_stimclasswrk] => Array
        (
            [und] => Array
                (
                    [0] => Array
                        (
                            [user] => 80
                            [average] => 80
                            [count] => 1
                        )

                )

        )


texts:
After I enabled the Book module, Drupal suggested to add a new book page and give it a title.
On my site, I'd give a title to a book only to chapters; for regular pages, I just use a title using a progressive number, such as Page 1, Page 2, Page 20.
I saw in some video the title is mandatory.

Why are titles required for book pages?


texts:
Product in your cart active only 20 minutes, then is removed

how to do?


texts: Simple jquery instructions attached on form is not executeing

texts:
I have a very simple js attached to a form, and I cannot see why it is not executing.

(function ($) {
    alert("test");
    $('#field-ai-event-date-unique-add-more-wrapper').hide();
    $('#field-ai-event-date-range-add-more-wrapper').hide();
})(jQuery);

The alert is popping up as expected, the jQuery instructions are not executed. They work fine in the console and hide the form elements as expected.

What is the problem here?


texts: Term reference field lists the terms for all the languages

texts:
What I meant is that I have the i18n module installed and configured for content and taxonomies, this is what I need

I have a taxonomy called "Colors" I have translated all the terms of this taxonomy from spanish to english

I have a term reference field in a content type that points to the taxonomy "Colors"

While I create the the node of that content type and try to select a color, the select list shows me all the colors in english and spanish, is there a way of update that term reference select list to show only the terms for the selected language for that node?

Check the image and you will understand what I mean

If you check the image I selected in the list as language spanish, but in the color checkboxes it shows me all the terms in both languages (English & Spanish)

How to show the terms depending of the selected language while creating the node?

This is the image of the translated and original taxonomy terms in Spanish and English


texts: So I've installed FirebugForDrupal (updated)

texts:
I installed the browser plug in and module in drupal. On this (development environment) I gave authenticated users access to the 'Access Firebug Debug' permission. Site Admin has access to that and 'Execute Firebug PHP'.

Browser/Client

Firefox 17.0.1
Ubuntu 11.10
Firebug 1.11.0
DrupalForFirebug 0.0.8 2.0
Logged in as User 1

Server (development box)

Drupal 6.25
Redhat 5.8
PHP 5.3.3

UPDATE:

Just this morning DfFB released it's 2.0 version. I spun up the DfFB module again, ran cron, and cleared cache. In the source code of my page, I can now see <div>'s  with class names such as drupalforfirebug_general and drupalforfirebug_sql. So it appears that information is binging handed to the browser from Drupal.

UPDATE 2:

I switched to DfFB 2.0a and this what I see.

Is this what I'm supposed to see?


texts: Not able to show node comments on a view -content pane

texts:
I' a bit stuck with this. I am using panels in Drupal 7. I have created a new content type. I am crating a page (page manager) and I am using a view content pane inside a panel in the page. In that view I am filtering nodes of that particular content type I created. I am not using fields but the full content of the node and I can't figure it out why it doesn't show comments. If I change to page view, for example, I can see the comments, but not using content pane.

What am I missing? Might it be something about the template?

Thanks in advance for your help.


texts: Set and read data in session between anonymous and authenticated user

texts:
On my Drupal 8 site, when an anonymous user "A" visit this link: https://www.example.com/page-1?data=12345678, I want to store the data value in a session and save it later to the user account under field_user_data when this same user "A" login/signup to the site.

Note: The query data will be unique for every single user and will not be used twice ever.

I thought the best way to go is by using the data value in a session and use it later when the same anonymous user becomes authenticated on the site.

So on site load and when user "A" is using the site as anonymous, I am saving the data value in a session using:

// Get query values from url.
$request_query = Request::createFromGlobals();
$data = $request_query->query->get('data');

// Save the "$data" in a session variable.
$tempstore = \Drupal::service('user.private_tempstore')->get('my_module');
$tempstore->set('data', $data);

and later, in another php file but within the same module, when the anonymous user "A" authenticate to the site, I am saving the session value to his user account as shown below:

// Get 'data' Session value
$tempstore = \Drupal::service('user.private_tempstore')->get('my_module');
$data = $tempstore->get('data');

// Set 'data' value to user account.
$authenticated_user->set('field_user_data', $data);

// Save
$authenticated_user->save();

The problem is $data session is shared between all users and not being unique per user while $data value must be unique for every single user.

What is wrong with my code ?
Using cookies will be a better approach for my use case ?

Update #1:

Using above code to store sessions or using the method provided here https://drupal.stackexchange.com/a/246268/88628, both are working as expected but in only one case (For authenticated users)

When an authenticated user visit https://www.example.com/page-1?data=12345678 (where 12345678 will be unique per user), both above methods are working as expected and the value 12345678 is indeed saved to the authenticated user account under field_user_data field.

However, when User "A" visit https://www.example.com/page-1?data=12345678 as anonymous user and then later decided to login/signup, both above methods are not working for me!

Note: For now I am using cookies by using setcookie('data', $data, 0, '/'); and $data = $request->cookies->get('data'); and it is working for both anonymous & authenticated users.

But I would really prefer to get it done using sessions !


texts: Is there a module that allows incremental increase/decrease on the submit form field?

texts:
Im trying to improve the accuracy of my content creation forms while allowing the same flexibility. I was messing around with airbnb and they have these number fields that get filled out with a + - counter type option (see picture).

have + - buttons to increase/decrease the number
allow people to type numbers into the field input.
force only numbers as input.

Is there a module that allows for this funciton with a number field?


texts: Addressfield: format US state as two letter abbreviation?

texts:
Using Drupal 7 with Address Field module.  How do I get the US state (i.e., the administrative_area) to show as a standard two letter abbreviation rather than the full state name?

What shows now is:

123 Main St
Somewhere, Florida 12345

I want the node to show:

123 Main St
Somewhere, FL 12345

UPDATE

In address.inc in the addressfield module files, there is a function addressfield_format_address_generate which defines an '#options' array of all the different states (an associative array with 2-letter state abbreviations as the keys and state names as the values).

In addressfield.module, there is a function _addressfield_render_address which I believe checks if there is an '#options' defined and if so, tries to get the value for the given key.

So it would seem if I want to change this behavior I somehow need to override _addressfield_render_address


texts: How do I hide buttons like the "delete" one in a node form?

texts:
Consider I created a CCK node called assignment, and I am adding assignments with that.

There is a field called "published" with a check box. If the assignment is published, then it should not be deleted.

My problem is how I can hide the "delete" button if the assignment is published. By using prefix and suffix and using display: none; in hook_form_alter() will work, but it is not the secured way. I need something in the Drupal way.


texts: How to pass contextual filter to a view pane?

texts:
I have a taxonomy page where different view panes of a single view are displayed. I want to pass contextual filter to only kind of View pane. I wrote this code but this passes the contextual filter to all the view panes on the page. How can I pass contextual filter to a single specific view pane? Thank you for your time.

function intrakicalendarrss_views_pre_view(&$view, &$display_id, &$args) {
    $arg0 = arg(0);
    $arg1 = arg(1);
    $arg2 = arg(2);
    if($view->name = 'current_event_list')  {
        if($arg0 == 'taxonomy' && $arg1 == 'term' && ($arg2 == 1 || $arg2 == 2)) {
            $Cfilter = $arg2;
            $args[0] = $Cfilter;
        }
    }
}


texts:
How to edit breadcrumb info without install any drupal module?
Example: blog
Home >> blog >> admin's blog

I want to remove admin's blog

I cant find node--blog.tpl.php file.

I only can find node.tpl.php file.

Many Thank.


texts: Adding new rows on a draggable table via jquery

texts:
I have a draggable table with preloaded "new items" - sorta like the Power Edit feature of the menu_editor module. Everything works perfect.

However, I want to have a button that adds a new row via jquery. I was able to do this via the following code. However, the new rows added by jquery are not draggable. What can i do to make it work? Is it even possible?

var preloaded_items_count = '.$preloaded_items_count.';
$("#edit-add-new-item").click(function(){
  var append_tr = $("#guide-pages-table tr:last").clone();
  var replace_pattern = new RegExp("new-" + preloaded_items_count, "g");
  var new_item_id = "new-" + (preloaded_items_count + 1);

  //append_tr.find("a.tabledrag-handle").remove();
  append_tr.html(append_tr.html().replace(replace_pattern,new_item_id));
  preloaded_items_count = preloaded_items_count + 1;

  //Drupal.tableDrag.prototype.makeDraggable(append_tr);
  $("#guide-pages-table > tbody:last").append(append_tr);
  return false;
});


texts: get views customfield php value in another field

texts:
i create a views in drupal 6.24.set up some field like username and uid,
in third field used customfield php .with my custom php code filled this filed,
in another customfield php want use the value of customfield php value ,how can i do it?
i know with $data->uid (if userid exist im my views filed) can get current row uid.
i test $data->phpcode but return null to me. please tell me about how can i get customfield php in views?


texts: Registration email token outputted as link instead of plain address

texts:
I am using Entity Registrations for user registration to events on my Drupal 7 site. After the Registration i want to send an email to the registrant, with the Rules Module. So i need a token to get the recipients mail address. I tried

  [registration:user:mail]

and

  [registration:mail]

but i get the address with a link (example: "mailto:test@test.com"). Is there a way to get the raw value of the mail tokens out of this?


texts:
I have a site that had display suite installed, but the custom view mode I'm trying to delete is not listed in the display suite admin page (admin/structure/ds/view_modes).

So I tried disabling/uninstalling all DS modules, and that didn't seem to help. I re-installed the module and confirmed the ds_view_modes table is indeed empty.

I know I can uncheck the checkbox to disable it for a given content type, but I want it gone completely so it doesn't cause confusion.

In the image, you can see the extra display is called "Classified Ad"

How can I accomplish this?


texts: Entity reference field with custom class

texts:
I created two content type Writer & Book. Writer has entity reference field that link to Book nodes. When display Writer node, I like the book nodes that attached to it display as list and the first list item has CSS class of "first".

Output the list is simple but I couldn't figure out how to add that CSS class.

If possible, I prefer do it with template.php or node--content_type.tpl.php flies, not using JQuery, Views or another modules.

Appreciate any suggestions, Thanks!


texts: How do I avoid caching a redirect response from a form?

texts:
I have a Drupal 8 form used by authenticated users which sometimes needs to redirect based on the presence of absence of something in session. I don't want the redirect to be cached.

My form is displayed directly with a route. i.e., the route has a _form default pointing to the form class.

My buildForm method starts like this:

public function buildForm(array $form, FormStateInterface $form_state)
{
    $form['#cache'] = ['max-age' => 0];

    if (some value not in session) {
        $response = new TrustedRedirectResponse($some_url);
        $response->setMaxAge(0);
        throw new EnforcedResponseException($response);
    }

    // build the form.
}

I have not been able to avoid the redirect response being cached. It redirects as expected if the session variable does not exist but continues to redirect next time when the session variable does exist.

Users are authenticated so it is the dynamic page cache. drush cr or uninstalling the dynamic page cache "fixes" the problem.


texts: Use selected NID from Entity Reference field to populate second Entity Reference field

texts:
I have three content types:

organization profile
internship posting
hours submission

The 'hours submission' content type has two entity reference fields:

Entity reference for 'organization profile' nodes
Entity reference for 'job posting' nodes

I'd like to pass the NID from the first entity reference such that the second entity reference is filtered (only shows nodes that are associated with that NID).

The 'job posting' content type is tied to an 'organization profile' via an entity reference field.

Any help or guidance would be appreciated.


texts: How to allow anon users to select contacts from civi in webform?

texts:
I'm using civi and webforms to gather custom data, in this case an application for examination of a student, I have two contact fields; one for the user (student) and another for the examiner.

I have set the choices available from the examiner fieldset to only allow for contact belonging to our instructor group in civi as choices. Works great if you have civi permissions but not for anon users or users without civi permissions.


texts: Drupal 7 - Programmatically create field collection within field collection

texts:
Example: Map (node) has unlimited areas (field collection field). Each area has unlimited layers (field collection field). The area fc. have normal fields and the layer fc. The layer fc. only have normal fields.

I can create a field collection on the node, but unable to figure out how to attach another field collection to it. I assume the 2nd fc. should use the 1st fc. id as HostEntity.

The code is running in a custom module, and it should create the Map node.

Any ideas, suggestions?


texts: Use product entity field as filter in Views

texts:
I have a product (type: "lamp") with a text field called "power".
On the Product display node ("showcase") i also want to see a block made with Views. It must show three other products of the same type AND power value. So Views should get a field's value of product rendered on the same node.
I've tried a lot of modules, various relationships combinations, but still can't get a product's entity field value.
Please tell me, what modules do i need and where should i go step by step.
(here are the modules i've installed: References, Entity Reference, Field reference, Node Reference, Field collection)


texts: Hide taxonomy term in specific node form

texts: I have a select list of taxonomy terms, all terms are needed for searching in views, but I don't need for insert new content. I wrote a custom module, which Hook should I use to hide some terms of my select list?


texts: How do you configure draggableviews permissions?

texts:
How can I configure draggableviews permissions so that I can sort and save my gallery (as in photo gallery) but no other visitor can?
I want to be the only one with permission to sort and save my display. As of now, I can sort and save other users' displays.
Is that normal behavior?


texts: Search Api Solr view cannot retrieve node. ID incorrect?

texts:
Drupal Core 8.7.8
Search API 8.x-1.14
Search API Solr 8.x-3.7
Solr 8.1
Solarium 5.1.4

The current Solr config is exported and loaded in Solr.
Indexing from Drupal works.

The Solr Index View shows the correct number of results in the header, but shows the "no results" content.

Looking in the logs I see:

Drupal\search_api\SearchApiException: The datasource with ID 'lhltl6--entity:node' could not be retrieved for index 'Solr index'. in Drupal\search_api\Entity\Index->getDatasource() (line 369 of web/modules/contrib/search_api/src/Entity/Index.php).

If I look at the indexed data in Solr the IDs look like this:

    "id":"lhltl6-solr_index-entity:node/100:de",

When the solr ID is created, the name of the index seems to be added to the ID. But when the document is read in the view, the index ID would seem to be missing.

The View seems to be querying the correct rows, but is trying to retrieve the documents with an incorrect ID.


texts:
I have a confirmation email. In the confirmation email i print the Date of the event (Date field) in the e-mail body by [entity-fetched:field_event_date].

This is working fine but the Date is printed like 2016-04-13 16:30:00 to 2016-04-13 20:00:00

How do i print a custom Date format like i.e. 09-Jan-2016 in my email body?


texts: How to limit entity and/or field translation permissions to selected languages only?

texts:
Is it possible to give some user/role the permission to translate only one language?

I've seen these permissions:

Translate any entity.
Translate field content for any fieldable entity.

But these permissions allow users to translate all languages.

I have one user that has to translate to English and another user who translates to German ...