texts: Testing an update hook that updates fields?

texts:
I wrote an update hook for a site that moves data from one field to another. It looks a lot like this gist:

  foreach ($node_ids as $node_id) {
    try {
      $node_wrapper = entity_metadata_wrapper('node', $node_id);
      $node_wrapper->field_new_field->set($node_wrapper->field_old_field[0]->value());
      $node_wrapper->save();
    }
    catch (Exception $e) {
      watchdog('mymodule', 'Problem with node @node_id', array('@node_id' => $node_id), WATCHDOG_ERROR);
    }
    $sandbox['progress']++;
  }

It's being tested on CI (Travis) which runs "drush updatedb -y" so what I was wondering is if there is a way to query a particular node and make sure the field is populated? Like for example make sure the data in field_new_field is the same as _field_old_field and printing that on the command line?


texts:
I'm a Drupal noob, so this may be a simple question. I have two taxonomies created, one called Programs and another called Divisions. There is a "Division" field in the "Program" taxonomy. For example:

Programs

Math
English
Art
Communication
Biology

Divisions

Humanities
Science

Art, English, and Communication are all related to Humanities
Math and Biology are related to Science

I have used Views to build a page that will display information for each program. URL format is academics/programs/biology, academics/programs/art, etc.

I'm trying to create a Views pane that will display related programs, but I'm having some difficulty. Essentially, I want it to a display a list of programs that have the same Division. How would I go about accomplishing this since the URL does not have the Division term in it, but rather the Program term?

Any help would be appreciated.

Thanks!


texts:
Fatal error: Class 'EntityInterface' not found in /cptestd8/modules/custom/custom-autofill-reference/custom_autofill_reference.module on line 13

use Drupal\node\Entity\Node;
    function custom_autofill_reference_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {

      drupal_set_message($form_id);

      if($form_id =='node_monitoring_report_form'){
        $field_school_information =  \Drupal::request()->query->get('field_school_information');
        $node_details = Node::load($field_school_information);
        $node = $node_details->field_FIELD_NAME->value;
        $form['field_school_information']['widget'][0]['target_id']['#default_value']=  $node;

      }
    }

While trying to load the node I get error as shown below:

  Fatal error: Class 'EntityInterface' not found in
  /modules/custom/custom-autofill-reference/custom_autofill_reference.module
  on line 13

And line 13 is:

$form['field_school_information']['widget'][0]['target_id']['#default_value'] = $node;

Drupal Version: 8.6.x


texts:
Any panels experts here? I want to clone a panels page with fieldable panels panes on it. I can use the clone option in the page manager. It creates a new page at a new url but the FPP are just referencing the original. So if I change the fpp content on this page, it will change it on the original page and visa versa.

How do I get a true clone with new (editable) fpp instances?


texts: What functionality is available from Drupal.theme()

texts:
I have some complex data in javascript I need to render, mostly as tables.

This page explains how to add new theme functions, but I just want to create basic vanilla html. This apparently is the "official documentation."

I can't for the life of me find a list of the functions/functionality available in Drupal.theme()

I note this list of functions available from php - but I'm assuming the javascript version is a subset?


texts: Ajax on Add another item of field collection

texts: I'm calling an Ajax function in a field collection. But after hitting 'Add another item' button, form looses Ajax effect. I want to bind the Ajax with form event after clicking on 'Add another item' button. Can anyone help?


texts: Views: Sort items using contextual filter arguments

texts:
Im trying to create a block of "Related products", I have 3 criterias for show the related products: Color, Texture and size. These are taxonomy vocabularies.

In the view I can use contextual filters for get the matching products while viewing another product. These results are sorted alphabeticaly by default in the view.

Im trying to show first the items that match the Color of the product, then the ones that match the Texture and then those that match the size.

Can someone tell me if this is possible? and how would you do it?

This is the screenshoot of the view


texts: Dynamic language negotiation by multiple top level domains

texts:
I am porting www.example.com, the German version is at de.example.com, the French is at fr.example.com and so forth. I could enter these domains in admin/config/regional/language/detection/url but I would like them to be subdomains: if one visits www.example.test then (www,de,fr).example.test should work, and if one visits www.example.local then (www,de,fr).example.local should be the translated domains and so forth. It seems I need to make the results of $config = $this->config->get('language.negotiation')->get('url'); dynamic. I am at a complete loss at how to implement this:

I could write an entirely new plugin based on LanguageNegotiationUrl. If I started with a copy of it, I could drop processInbound and half of getLangcode but the rest would need to stay -- and given how little change needs to happen, that's a lot of code to keep in sync with core.
I could patch LanguageNegotiationUrl factoring out the four $config['domains'] interactions into a method and then extend accordingly. Much less maintenance pain than the previous one but at the same time, it's a core patch. Of course, composer-patch applies them after updates but still, a core patch for this?
I could write a config override which overrides language.negotiation but it seems the overrider doesn't get the data loaded. So I'd need to get the domain map from somewhere else, for example by re-reading it from the config storage. That's really, really wasteful.
I could write a "super saiyan config override" by decorating the config factory service so when the language.negotiation is get() then do something with it, like put the dynamic overrides in setModuleOverride. OK, that's not a lot of code, great, the proxy script will write most of it, even better, but now all config calls are a hair more complex and a hair slower.

Any clean ideas I missed...?


texts:
In Drupal 7, you can use taxonomy-term.tpl.php to override taxonomy pages.

Inside the taxonomy-term.tpl.php page, you can use <?php print $term->field_NAME['und'][0]['value'];?>to print out the content of any fields attached to the taxonomy term. (*)

However, how do you get to the list of nodes that is displayed on the taxonomy page?

There doesn't seem to be anything in the taxonomy-term.tpl.php file to indicate how to theme the nodes that are displayed on the term page.

I know you can use Views to over ride the page. However, Views does not let you display nodes tagged with a term and fields that are attached to the term in a single View.

(*) I know you are not supposed to use UND. However, the correct method for access node based fields does not seem to work with taxonomy based fields.


texts: Form is not submitting after ajax callback

texts:
I have a form which has a checkboxes field.

This field has an ajax callback attached

$form['checkboxes'] = array(
  '#type' => 'checkboxes',
  '#title' => 'test',
  '#ajax' => array(
    'callback' => 'mymodule_ajax_callback',
    'wrapper' => 'test-wrapper',
    'method' => 'replace'
  );
);

function mymodule_ajax_callback(&form, &$form_state) {
  return $form['another-field'];
}

When I check a checkbox, the ajax callback is executed. Then when I try to submit the form through form submit button, it reloads the same page with values in the fields, but the form is not submitted.

I have tried $form_state['rebuild'] = TRUE in the ajax callback also but it did not help.

I have added the #name and #id properties also to the submit button but no luck.

Is there any other solution which I can try?


texts: Help required to set up multisite using organic groups (OG module)

texts:
I would like to create different multisite using organic groups in drupal. Each organic group would be a subdomain or domain. How can I achieve this functionality? I do not want to use domain access module.

What I exactly want is, when an organic group is created it should ask for the subdomain or domain and the user can enter the subdomain or domain which is to be associated to that organic group. Then when the user enters the subdomain.site.com the appropriate organic group should load. site admin associate to this organic group can login like this subdomain.site.com/user.

How can the above scenario achieved through organic groups?


texts: How to add a media type to drupal_add_css in custom module

texts:
I’ve got a question about adding CSS to a custom module.

Originally I’ve been given this line:

link rel="stylesheet" type="text/css" media="screen and (max-width: 640px)"    href="mobile.css"

And I’ve converted it into:

drupal_add_css(drupal_get_path('module', 'savingsscore') . '/css/mobile.css', 'screen and          (max-width: 640px');

The file is being attached, but the media setting is wrong and I don’t know what it should be. I’m in Drupal 6.

Thanks!


texts: Updating entities/posting data via ajax?

texts:
I've got a handful of entities that need to updated on user interaction, such as:

Tracking user progress through a video, such that a listener checks playhead position every x seconds and posts information to an entity containing data on that user's progress on that video.
A collection of checkboxes that, when clicked, automatically update the state of a corresponding value on a related entity. For the sake of argument, I don't yet know if this will be the actual entity form or a generic form/set of forms.

In the past I attempted #1 by having a hidden, ajax-enabled form whose field values were updated every x seconds and the submit button automatically clicked, but this caused assorted ajax errors for some iOS users that were difficult/impossible to debug. Ideally I think I'd like to bypass having a form there at all. I know how to setup the js to track the data, but I'm not sure how to then pass it along to Drupal from the front-end. I'd assume I want to do something like this (via http://hayageek.com/jquery-ajax-post/), but not sure exactly how to determine the AJAX_POST_URL or how the data should be formatted.

$.ajax({
    url : "AJAX_POST_URL",
    type: "POST",
    data : formData,
    success: function(data, textStatus, jqXHR)
    {
        //data - response from server
    },
    error: function (jqXHR, textStatus, errorThrown)
    {

    }
});

For #2, I suppose it might be enough to just have a form that autosubmits via ajax when the checkbox is clicked, but given the misc errors I hit above I'm curious whether or not there might be a better way to handle it.

Happy to update this issue as needed if it's deemed too generic.


texts: Ubercart 2.x: Given a product nid, retrieve its manufacturer

texts:
I'm trying to figure out how Ubercart stores manufactures.

Currently it's set up as a Vocabulary, but I can't figure out how to grab that info programmatically given a product nid.

Any advice?


texts:
We are planning to create an 'agency' site on drupal. The 'agency' site will serve as 3-tiered system model composed of the following levels:
1. Agents (users)
2. Agency (agent users will belong to a specific agency)
3. Super Administrator (controls everything, permissions etc)

The idea behind the site is to have the ability to register an 'agency' (only by the super admin), that will in-turn have the ability to create their own users (Agents).

If Agency1 logs in, he should be able to register their own sets of users. So goes with other agencies. New users created should belong exclusively to their respective agencies, automatically upon registration.

Are there any modules out there that can be configured to do this? I have 'Profile 2' Module but I don't think this fits the bill. I am looking at the Groups Module but not sure if this is really the right one.


texts:
I have this kind of menu set up in my Drupal 8 project.

Level 1 item A1
    Level 2 item A2
    Level 2 item B2
    Level 2 item P2
    Level 2 item Q2
Level 1 item B1
    Level 2 item D2
    Level 2 item E2
Level 1 item C1
    Level 2 item Z2
    Level 2 item X2

Is there any way to create a page containing all the submenu links on a page. The desired result would be:

Click on "A1" menu link
Display a page containing A2, B2, P2 and Q2 in a list(the direct children of A1)

I've tried setting this up using views, the problem with that is i don't find a way to filter based on the parent menu item. Only the type of the node and therefor it shows all my content.

Is it possible to use views to achieve this, or is there a better way?


texts: Finding the Machine Name of an Module-based Field Added to $content variable

texts:
I need to edit a field added to my $content variable by a contrib module called Print, email, and PDF versions. It creates a link at the top of the content region that says 'Print PDF' and prints a PDF of the page. I've looked everywhere in the admin settings for the module for this information but can't find it anywhere.

Note: I've tried looking in my DB and trying what I found in there for the field, with no luck. I also tried using var_dump but that doesn't help me. I looked in the print.module file but wasn't seeing anything in there, although to be fair it's quite voluminous so I might have missed something.

I'm trying to access it and hide it through code in node--resource.tpl.php so I can manipulate it independently of the rest of the vars in $content. This is the code I'm using successfully to hide OTHER items in $content for example:

// #nomarkup is a function defined in template.php
$content['field_body']['#theme'] = "nomarkup";
hide($content['field_body']);

With Firebug, the DOM shows  followed by  for the PRINT PDF link I want to hide, but neither of those seems to be recognized when I try to hide them using a similar format as the other items in $content, like so:

$content['print-link']['#theme']

or

$content['print_pdf']['#theme']

respectively. I even tried removing the ['#theme'] part but that didn't help.

Anyone know a good way to find the machine name of this variable that seems to have been added to $content but is not showing in admin > content type?


texts: How to specify the numbers of characters for teaser for views block?

texts: I know we can specify the specify limit for the teaser by going to content type -> manage display -> teasers. I have made the views block for teasers and I want to display only few lines for that content in particular views block and do not want to affect the stand treasure setting. So, is there any setting in Views which specify the teasers limit for the particular Views block?


texts: Data Processor missing from Feeds' 'Select a processor' view

texts:
I installed the Data, Schema, Job Scheduler, and Feeds modules in Drupal 7 and am not seeing the "Data Processor" on the Feeds' 'Select a processor' view when creating a new importer. I even created the Data table, and tried with and without it being an entity (the Data module in D7 allows you to define tables as entities.) All perms are checked for my role.

I'm running Drupal 7.41 and I tried with Feeds 7.x-2.0-beta1 (latest stable) and the latest dev version of Feeds (2016-Jan-06).

I don't see a "FeedsDataProcessor.inc" file in feeds/plugins/ like there was in the Drupal 6 version. Could that be the problem? If so, why would it be missing from the Drupal 7 version?

Thanks!


texts: user-profile-edit.tpl.php not working for user#1

texts:
I am going crazy on this one :-/

I have overridden my user edit page with a user-profile-edit.tpl.php

In my template I have:

function mytheme_theme() {
  $items = array();
  $items['user_profile_form'] = array(
    'render element' => 'form',
    'path' => drupal_get_path('theme', 'mytheme') . '/template',
    'template' => 'user-profile-edit',
    'preprocess functions' => array(
      'mytheme_preprocess_user_profile_form'
    ),
  );
  return $items;
}

My problem is that my user-profile-edit.tpl.php is not being picked up by user#1,
it is working however for all other authenticated users.

Is there some setting i am overlooking here?


texts:
hello i am trying to create a custom field type in drupal 8 containing two text fields and an entity reference field to a user , but i get this error when i try to save .

  Error: Call to undefined method Drupal\Core\TypedData\DataDefinition::getTargetDefinition() in Drupal\Core\Entity\Plugin\DataType\EntityReference->getTargetDefinition() (line 51 of core/lib/Drupal/Core/Entity/Plugin/DataType/EntityReference.php).

below is my custom field definition :

public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
    // Prevent early t() calls by using the TranslatableMarkup.

    $properties = [];

    $properties['street'] = DataDefinition::create('string')
      ->setLabel(t('Street'));

    $properties['city'] = DataDefinition::create('string')
      ->setLabel(t('City'));

    $properties['user']   = DataDefinition::create('entity_reference')
            ->setLabel(t('user'))
            ->setSetting('target_type', 'user');

    return $properties;
 }

Any help or tip would be very welcome , thank you :)


texts: View of users flagged by a user, users flagging a user, and nodes from users flagged by a user

texts:
I have a user flag that is pretty much like a "follow" or "subscribe" function.

Basically I want to create 3 views for my website's user profile pages:

  A list of users flagged by a user (e.g. a "people i'm following" block)
  A list of users flagging a user (e.g. a "my fans" or "my followers" block)
  A list of nodes from all the users that have been flagged by a user (i.e. a news feed function for a user to view all the new content
  from the users he/she flagged)

Would appreciate any help or comments!


texts: Call $created variable in content type node template

texts:
How can I call the $created variable in my content type node template? I tried the following but it just produces what seems to be a random string of numbers:

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


texts: Preventing spam registration /url redirect

texts:
im getting more and more spam account registrations. what is the simplest way to handle this if one does not need browser based registration? people register the REST/services way via an app.

can this be achieved without additional modules? e.g. server redirect?


texts:
I'd like to clear the managed file field each time the contents are sent off for further processing on submit.

The callbacks work fine, but I have repeatedly come unstuck in my goal of having a "fresh" form everytime I need to submit a new image.

The form is defined thus:

function mymodule_form($form, &$form_state) {

$form['Input type'] = array(
    '#type'=>'fieldset',
    '#title'=>'Upload your image'
);

$form['Input type']['file'] = array(
    //file left in non-permanent state for testing purposes
    '#type' => 'managed_file',
    '#title'=> t('Upload image'),
    '#description' => t('Choose an image to upload. Format must be gif, png, jpg, and may not exceed 2MB in size. Press Submit to confirm your selection.'),
    '#upload_validators' => array(
        'file_validate_extensions' > array('gif png jpg jpeg'),
        'file_validate_size'=>array(512*512*512),
    ),
    '#upload_location'=>'public://mymodule_uploads',
);

$form['Input type']['submit'] = array(
    '#type'=>'submit',
    '#value' =>t('Submit'),
    '#submit'=>array('mymodule_clear_image_submit'),
    '#ajax' => array(
            'callback'=> 'mymodule_update_image_callback',
            'wrapper'=>'somediv'
        ),
);
return $form;
}
function mymodule_update_image_callback($form,&$form_state) {
$picture_settings = array(
        'image' => file_create_url($form['Input type']['file']['#file']->uri)
        );
    drupal_add_js(array('mymodule' => $picture_settings),'setting');

    return;
}

function mymodule_clear_image_submit($form,&$form_state) {
$form_state['complete form']['Input type']['file']['#file'] = NULL;
$form_state['rebuild']=TRUE;
return;
}

Neither the submit nor the callback functions seems to be refreshing my form. Setting the file value to NULL has not had an effect either.

I don't know what else to try. Cheers!


texts: Does Drupal 7 have built-in functionality for using jquery overlays? I would like to do some confirmation screens and form-wizard type stuff with them.


texts: Call Drupal PHP function from Javascript?

texts: I'm trying to get the content of an article and display it using AJAX by replacing the content of a div with the new article's content. In order to do this I want to make an asynchronous jQuery call to a PHP page that simply outputs the article's body. However, this PHP function needs access to the Drupal PHP functions in order to operate properly. Where or how can I create a PHP file that will have access to these functions in a Drupal install?


texts: How to move an article to another place.

texts:
I just add 10 articles in my drupalwebsite, but now I want to change the place of my articles.

The article that I have added first is now at the bottom. This should be at the top. Everything is in reverse order. How can I change this?

Thx for helping.


texts: How to re-add deleted articles using the same node ids?

texts:
I am running a drupal 7 website with about 1800+ articles. There were about 40 articles deleted overtime from the website. What I want to do is add  those articles again using the same deleted NIDs. How should I go about it?

Is adding these articles manually through phpMYAdmin a good idea? Are there other database tables I have to consider other than the following:

(1) node

(2) field_data_body


texts: How can I display a confirmation message after someone subscribes via simplenews?

texts:
I want to show a message after users submit their email in Simplenews block.

Currently when the user clicks on the subscribe button, the page is refreshed and no message shows ups.

Instead, I prefer to show a message with javascript in modal or something.

Any help/suggestions?


texts: Defined variables losing value after using drupal_bootstrap

texts:
We're trying to use drupal_bootstrap to be able to delete a drupal user when a user is inactivated in our internal (non-Drupal) system. It appears that all defined variables set prior to the bootstrap call are losing value as soon as the call is made. Here's the weird part: it only happens on our live server - everything runs perfectly on dev.

Here's the code; I've stuck a whole bunch of error_log statements in so I can see exactly where the variables are disappearing.

//email address is empty; delete institute record - but not if it's user 0 or 1
if($institute_uid > 1) {
  error_log("institute uid right before bootstrapping drupal: $institute_uid");
  //previous line prints and the $institute_uid is correct

  //set the working directory to your Drupal root - necessary for delete user function
  chdir('/home/www/institute');

  //require the bootstrap include
  require_once './includes/bootstrap.inc';

  //Load Drupal
  drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
  //(loads everything, but doesn't render anything)

  error_log("institute uid immediately after bootstrap = $institute_uid");
  //previous line prints but the $institute_uid value is blank

  $test = "123";
  error_log("test = $test");
  //previous line prints and $test value is correct

  user_delete(array(), $institute_uid); //$vuid = institute_uid from new_people
  $body .= '<br />Institute account deleted';

}

Any ideas? We're new to the bootstrap stuff; maybe there's a server setting, or line in a .ini file somewhere in Drupal that needs to change on our live server?


texts: Creating a Field in order to add Icons to content's Title

texts:
we want to add Icons before the Content's title just like the picture below (icon before Glory of the Hero):

but the problem about the stuff already existing in prior asked questions is that we're gonna work with that a lot in our site , so if we're gonna code it for EACH title, it wouldn't be useful for us >>>>> so we wan to add a field in our content types for example called title's image , and so each time we upload a file there, we'll have an icon before that content's title.

I've already read:

Icon images with node title
https://www.drupal.org/node/140517
https://stackoverflow.com/questions/8976315/drupal-7-display-images-instead-of-nodes-titles
https://stackoverflow.com/questions/10665893/how-to-add-image-with-title-of-an-html-page
Optionally add image/icon after node title based on boolean content type field?
https://www.drupal.org/node/270332

and they didn't help at all...
is there any way to do that?


texts: Using select expressions or derived field in Views2 as fields?

texts:
Is it possible to use a select expression or a derived field as a field in Views2 in Drupal 6?

The advanced help documentation seems to indicate that perhaps it is possible:

  though it is very common to use
  non-fields to display data that isn't
  directly in a field, such as data
  arrived from formulae...

But they don't provide examples there.

What I mean is I'm looking for some way to indicate that the query should be

SELECT field1, CONCAT(field3, ', ', field4) AS alias1, IF( field5 > 10, 1, 0) AS alias2 FROM table ...

Can I specify the expressions alias1 and alias2 in native views2 functionality? If so, what is the syntax?

Or do I need a separate module?


texts:
I am using Drupal7. I also use ife module.  I also wrote a custom module

Here is my code

function mymodule_validate($form, &$form_state) {
    $name=$form_state['input']['name'];
    $pass=$form_state['input']['pass'];
    if(empty($pass) || $pass=='') {
           form_set_error('name', t('dummy message'));
        $errors=form_get_errors();
        print_r($errors);
        return $form;
    }

I also did some RND. when I check $form_state under complete form I got this array

 [complete form] => Array
        (
            [#action] => /logintest/node?destination=node
            [#id] => user-login-form
            [#validate] => Array
                (
                    [0] => user_login_name_validate
                    [1] => user_login_authenticate_validate
                    [2] => user_login_final_validate
                    [3] => mymodule_validate
                    [4] => ife_form_validator
                )

Here means the sequence of module working functions.

Now  when I print $errors,
it is showing

Array
(
    [pass] => Password field is required.
    [name] => Sorry, unrecognized username or password. Have you forgotten your password?
)

But I am accepting

Array
(
    [pass] => Password field is required.
    [name] => dummy message
)

But I don't know why it is not overwriting custom message..  Can anybody tell me how to resolve this issue.

Thanks a lot.


texts: Help me with my page, when open this page shows me this:

texts: PDOException: SQLSTATE[HY000]: General error: 145 Table './mapibrasil/watchdog' is marked as crashed and should be repaired: INSERT INTO {watchdog} (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9); Array ( [:db_insert_placeholder_0] => 0 [:db_insert_placeholder_1] => file [:db_insert_placeholder_2] => The file permissions could not be set on %uri. [:db_insert_placeholder_3] => a:1:{s:4:"%uri";s:18:"public://languages";} [:db_insert_placeholder_4] => 3 [:db_insert_placeholder_5] => [:db_insert_placeholder_6] => http://brasil.machupicchu.biz/ [:db_insert_placeholder_7] => [:db_insert_placeholder_8] => 190.237.102.164 [:db_insert_placeholder_9] => 1403795901 ) em dblog_watchdog() (linha 160 de /srv/www/machupicchu.biz/public_html/modules/dblog/dblog.module).


texts:
I'm using Display Suite for my website and I want to add a couple layouts to Display Suite, to apply to some pages. I have checked out how to add custom layout to Drupal Suite with google, Stack Overflow and Drupal Answers. What I did:

created a folder "ds_layouts" in my custom theme folder;
created a folder for my custom layout "ds-2col-stacked-custom" in "ds_layouts" folder;
created two files "ds-2col-stacked-custom.css" :

>

.ds-2col-stacked > .group-fhl {
  float: left; /* LTR */
      width: 70%;
}

.ds-2col-stacked > .group-fhr {
  float: right; /* LTR */
  width: 30%;
}

 .ds-2col-stacked > .group-left {
  float: left; /* LTR */
  width: 50%;
}

[dir="rtl"] .ds-2col-stacked > .group-left {
  float: right;
}

.ds-2col-stacked > .group-right {
  float: right; /* LTR */
  width: 50%;
}

[dir="rtl"] .ds-2col-stacked > .group-right {
  float: left;
}

.ds-2col-stacked > .group-footer {
  clear: both;
}

and "ds-2col-stacked-custom.html.twig" :

    <{{ outer_wrapper }}{{ attributes.addClass('ds-2col-stacked', 'clearfix') }}>

  {{ title_suffix.contextual_links }}

    <{{ fhl_wrapper }}{{ fhl_attributes.addClass('group-fhl') }}>
    {{ fhl }}
  </{{ fhl_wrapper }}>

  <{{ fhr_wrapper }}{{ fhr_attributes.addClass('group-fhr') }}>
    {{ fhr }}
  </{{ fhr_wrapper }}>

  <{{ header_wrapper }}{{ header_attributes.addClass('group-header') }}>
    {{ header }}
  </{{ header_wrapper }}>

  <{{ left_wrapper }}{{ left_attributes.addClass('group-left') }}>
    {{ left }}
  </{{ left_wrapper }}>

  <{{ right_wrapper }}{{ right_attributes.addClass('group-right') }}>
    {{ right }}
  </{{ right_wrapper }}>

  <{{ footer_wrapper }}{{ footer_attributes.addClass('group-footer') }}>
    {{ footer }}
  </{{ footer_wrapper }}>

</{{ outer_wrapper }}>

in file "Mytheme.layout.yml", I added:

ds_2col_stacked_custom:
  label: Two column stacked layout custom
  category: Display Suite
  class: '\Drupal\ds\Plugin\DsLayout'
  type: partial
  template: ds_layouts/ds-2col-stacked-custom/ds-2col-stacked-custom
  library: ds_2col_stacked_custom
  regions:
    fhl:
      label: fhl
    fhr:
      label: fhr
    header:
      label: Header
    left:
      label: Left
    right:
      label: Right
    footer:
          label: Footer

in file "Mytheme.libraries.yml", I added:

# DS.
ds_2col_stacked_custom:
  version: VERSION
  css:
    theme:
      ds_layouts/ds-2col-stacked-custom/ds-2col-stacked-custom.css: {}

In Manage Display for page I see the option for my custom layout, and when I apply it, it's working (html tags and css classes are added to the page), but it does not apply any of my css for my layout. I think there is something wrong with the way I added css file to my custom layout.


texts: Behavior to use .insertAfter() on load + after each ajax call?

texts:
So I have a views page that outputs some elements in the grid. And I have a custom block on the page that needs to be inserted between those elements. On load it using .insertAfter() to randomly insert that block between view content element in the grid.
The problem is it works on load, but after each Ajax call on the pager i want to insert same block again in the grid, but that elements does not exist anymore. Not sure how to resolve this. Here is my code:
Drupal.behaviors.modalYoutubeVideo = {
  attach: function (context, settings) {
    function moveTileBetweenElements() {
      // Get random number between 1 and 23 and insert after that :nth-child.
      var rndInt = Math.floor(Math.random() * 23) + 1
      var wrapper = $('.view-products .view-content a:nth-child(' + rndInt + ')');
      var tile = $('.block-custom-order-tile');
      $(tile).insertAfter($(wrapper));
    }

    moveTileBetweenElements();

    $(document).once('weberAjaxViews').ajaxComplete(function (event, xhr, settings) {
      moveTileBetweenElements();
    });
  }
};


texts: How to resolve the problems encountered when moving from local to server?

texts:
Which things do we need to be aware of and change when moving a site (in Drupal 8) from a local environment to a server?
In Drupal 7 I would just copy the files, change the database settings in settings.php, and import database, clear all caches, and that's it.
2 problems come up with the 'move files, move database' method, which are:

All links on the server-side site use the local url. Where does it get that information?

When I navigate to /user/login I get this error on a white page:

Redirects to external URLs are not allowed by default, use \Drupal\Core\Routing\TrustedRedirectResponse for it.


texts: print node click count using link click count module

texts: I'm using 'link click count' module and I  want to print and sort the view content based on click count.Is there is possibility to print click count or add the sort criteria for click count instead of ' link node id'.


texts: Hide/remove js-view-dom-id in just one specific view

texts:
I found, that the div with the id "js-view-dom-id" comes from views-view.html.twig. As I want to render one view output without any of Drupals HTML markup, I already hunted down the contextual links, which I can turn of for a specific view. Then I set the view format to an unused format, and removed all unwanted HTML markup from this views template as well.

Now I get plain {{ content.field_x.0 }}-output from this view. The only element left I need to get rid of is before mentioned "js-view-dom-id". I could remove this from views-view.html.twig, but then I would remove it from all views.

Is there any way to remove this markup for only one specific view? To be precise, I am using a custom content view mode, if that makes any difference.

Thank you very much in advance!

@edit:

Twig in views-view.html.twig looks like this:

{%
set classes = [
dom_id ? 'js-view-dom-id-' ~ dom_id,
]
%}
<div{{ attributes.addClass(classes) }}></div>

Is there any way to do something like:

{% if view mode is xy %}
// Do nothing
{%  else %}
<div{{ attributes.addClass(classes) }}>
{% endif %}


texts:
I am looking for a way to import Nodes to D8 from a source using Json Api
The node is having terms referenced but i cant find a way neither a tutorial to import and then reference thoses terms to the node

Any solution please Or example ?

Here how the object looks like

"field_terms": {
      "data": {
        "type": "taxonomy_term--terms",
        "id": "e6009802-3eef-4ffb-ac70-dab49bbd9b27"
      },
      "links": {
        "self": {
          "href": "https:\/\/website.com\/jsonapi\/node\/events\/34b9123c-d3cf-49e6-827b-946b59d46542\/relationships\/field_terms?resourceVersion=id%3A379"
        },
        "related": {
          "href": "https:\/\/website.com\/jsonapi\/node\/events\/34b9123c-d3cf-49e6-827b-946b59d46542\/field_terms?resourceVersion=id%3A379"
        }
      }
    },


texts: Different domains and content with one database

texts:
I would like to have different content for each domain. This is my scenario:

I would like to have these domains:

country1.hello.com
country2.hello.com
country3.hello.com
country4.hello.com

They all need to have the same content types, taxonomy, rules, ... . (Content will be different)

The domains are available in different langauges. So country1 has for ex. languages dutch/french/english (all the other domains TOO!).

I want this all in one database. And I also need one domain hello.com where you can see the content of all the domains!

Does someone has experience with this? I've seen the modules Organic Groups & Domain Access but haven't played with them.

I would like to ask for your opinion before I am halfway my project and hear it's not a good solution.


texts:
I'm trying to create a multistep/wizard form for Drupal 8.

User fills in a first name, last name fields
Clicks on the next button
Fills out more information
Clicks on the submit button

There are currently many resources devoted to multistep or wizard forms for Drupal 7 like this one and this.

On the other hand, I've had some trouble figuring out which is "Drupal" way of creating Drupal 8 multistep/wizard forms.

I did some research and figured there are several approaches:

Store values with the new configuration system
Use the wizard form interface (not in core yet)
Store values with drupal session object (not sure if that exists or not)

Are those valid approaches for Drupal 8?


texts: Show View Pane in Node Template based on Taxonomy Term

texts:
I am trying to add a view pane to a node template. The node and the content type shown in the view panel both have a taxonomy term field, so it should be a simple matter to link them, but I can't figure it out.

My node template has the relationship  Taxonomy term from Node. The view pane has context "has taxonomy term id" and has Argument Input from context. Unfortunately, I can't figure out what combination of selections I need to make in context and argument input to make it all work.

Under Argument Input, do I pick the field that contains the term or do I pick one of the choices under Taxonomy Terms?

Under Context filter value type, do I pick Term Name, Term from ID or something else (or nothing at all)?

I think I've tried all possible combinations, but I have the view showing up on nodes whether they contain the context or not. Any help would be greatly appreciated.

Drupal 7.37, Panels 7.x-3.5 and Views 7.x-3.11.


texts: Drupal Subtheme regions and customization

texts:
I am subtheming a Drupal base theme and adding custom regions to it. One of the custom regions is a menu bar which has say n number of items that redirect to basically the menu item pages.

Now each of these pages, I can foresee regions that do not necessarily adhere to the existing set of regions and custom regions. Basically each page has it's own unique set of custom regions. Which basically is leaving me confused as to how I can separately customize each page given that all pages on Drupal adhere to its' theme's regions.

I hope I am nailing the question here correctly, ask me to elaborate anything that you are not able to understand.

Thanks,

Parijat


texts: Relationship between two or more webform

texts:
Example:

Webform A: Fill up Particular
Webform B: Choose your product

Webform A Result: Peter, male, 22
Webform B Result: I want product A and B

Webform A Result: Mary, female, 21
Webform B Result: I want product A and C

When I view Peter particular, how to display webform B which state he wants product A and B. May I know how to do that?


texts: Global php view for conditional profile image

texts:
I have tried to configure a view for a user listing.
In this view only few fields from the user entity will be shown. In the user entity I have a boolean variable. If the boolean variable is TRUE ("1") the real profile image should be shown, otherwise the default image for all users should be shown.

In order to implement it I have added a views field of type Global: PHP.  In the field's code I wrote:

$file = file_load($row->picture);
if(isset($row->field_primum) ) {
if($row->field_primum == "1") {
print theme('image', array('path' => $file->uri));
else ($row->field_primum == "2") {
print();
}
}
}

However it runs only on the first user and not for all users in the display. Do you have any idea why?

Thanks
zanet


texts: Is it possible to move product category description alignment in drupal

texts:
Can any one suggest me to move Product description from top to bottom in drupal product category page.

Example Like :

First all product Image.
And Bottom content are shown.


texts:
I'm using drupal8 in headless mode.
So I have a backend on Drupal8, and a frontend in JS.
I'd like to have content URLs in drupal8 to point to the frontend domain and not the backend (which doesn't have any templates to display the content).

backend.example.com/mycontent for Drupal8
www.example.com/mycontent for the frontend

How can I do to update all the links in UIs to have the frontend domain in place of the backend domain ? (views or admin/content or breadcrumb on edit form).


texts: Commerce (and Commerce Kickstart) rendering add-to-cart buttons on any page?

texts:
Can someone school me or point me to a resource where I can learn how to render the add-to-cart buttons for specific products on any page? I know how to get them in a view and I'm using Commerce Kickstart.

The goal is simple, for the slider, I'd like to include an add-to-cart button for the slideshow product in the slide itself. The slides are content but they're not controlled by a view as Commerce Kickstart has it's own module for the slideshow. Even if it were a view, I don't think it would help.

So is there a way to print out an add-to-cart (even in PHP) like finding the add-to-cart variable for a product by id or something and just rendering it? Thanks.


texts:
I have a view with page display's page setting as following:

Path: some/path
Menu: No Menu

However it was overridden in templates by page--some--path.tpl.php for styling purposes. This tpl actually overrides page--some.tpl.php which is a base tpl for all pages located at some/* path.

I have now been asked to change this the path to some/path2. I did the same in views page settings. And created a tpl file page--some--path2.tpl.php.

Problem is that this tpl file is not getting detected and Drupal is using page--some.tpl.php as the template.

Why so?


texts: How to check in Rules if a text field has changed?

texts:
Not sure why this condition is ALWAYS evaluating to true. Trying to check to see if the value in a long text field has been changed.

The first field in the condition node-unchanged:field-security-audit (field type is Long Text) is always evaluating as true. The second field node-unchanged:field-security-audit-status-pubf (field type is term reference)is evaluating  properly.

Any help would be greatly appreciated.

Here is the rule export:

{ "rules_security_audit_status_updated" : {
"LABEL" : "Security Audit Status Updated",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"TAGS" : [ "security" ],
"REQUIRES" : [ "rules" ],
"ON" : { "node_update--api_publishing_form" : { "bundle" : "api_publishing_form" } },
"IF" : [
  { "OR" : [
      { "NOT data_is" : {
          "data" : [ "node-unchanged:field-security-audit" ],
          "value" : "node:field-sucurity-audit"
        }
      },
      { "NOT data_is" : {
          "data" : [ "node-unchanged:field-security-audit-status-pubf" ],
          "value" : [ "node:field-security-audit-status-pubf" ]
        }
      }
    ]
  }
],
"DO" : [
  { "data_set" : {
      "data" : [ "node:field-security-audit-timestamp" ],
      "value" : [ "site:current-date" ]
    }
  },
  { "mail" : { //send mail
    }
  }
 ]
}
}


texts:
I have created a custom menu (lets call it "mynav") and in my theme I've created a template specifically for it (block--menu--menu-mynav.tpl.php) which contains:

<div id="mynav" class="<?php print $classes; ?>"<?php print $attributes; ?>>
  <?php print $content ?>

This works fine.

However I'd prefer to apply the id to the unordered list that is generated and contained in $content. I guess I need to create a function MYTHEME_links__system_mynav_menu like this:

function MYTHEME_links__system_mynav_menu($variables) {
  return "TEST"; // Generate HTML here (
...)
}

but it doesn't seem to have an affect.

What am I doing wrong?


texts: A view to display only nodes related from user field

texts:
So I have user accounts and have added some custom fields to the user accounts. One of the fields is 'field_procedures' which is a entity reference to a content type called procedures.

Inside a view now, which is a calendar view, I want to display ONLY the procedure nodes that have been selected in the 'field_procedures' field that match that user. So that I am able to set which procedure nodes that are related to this user and want him to only see the calendar with of that node type he has been selected for.

I can't figure out how to set this up.


texts: How to connect database in UnitTestCase subclass?

texts:
I know there are mockups, data providers, bla bla bla.
I don't care now, I just want to connect to my dev site db and use nodes, terms for unit tests.

How can I do it? In D7 it was very simple in plain PHPUnit, what about D8?

I've tried bootstrap D8, but failed.


texts: Adding a field using `BundleFieldDefinition`, within an Entity Trait

texts:
I've gotten to a point where I'm having trouble connecting the dots with D8.  As a result, I'm not sure I'm even asking the right question.

At this moment, I'm trying to figure out how to add a field to a class that implements EntityTraitInterface.

As an example, Commerce License provides an Entity Trait for the commerce_product_variation entity type.

If the trait is enabled, a field (license_type) is added to the product variation form - this is done within PurchasableEntityLicensed.php.  I want to add an additional field to that, something like:

$fields['license_duration'] = BundleFieldDefinition::create('boolean')
  ->setLabel(t('License Duration'))
  ->setCardinality(1)
  ->setRequired(FALSE)
  ->setDisplayOptions('form', [
    'type' => 'boolean_checkbox',
    'weight' => 21,
  ]);

If I do that, and add the field to the form (in LicenseCreateForm), check the box on the variation for License Duration I get the following error when trying to save the variation:

Recoverable fatal error: Argument 1 passed to Drupal\commerce_license\Plugin\Commerce\LicenseType\Base::validateConfigurationForm() must be of the type array, null given

I'm not sure if I don't understand plugins well enough, or specifically, field plugins, or maybe Commerce.  I don't know what I don't know.

So, to be specific: how am I supposed to add this field so that it works?


texts: How do I exclude a term from an Exposed filter in Views?

texts:
So I'm creating a view that filters out content and only displays content as long as it has a specific value from a taxonomy selected.

So I want it to start with Sci-Fi, but the filter is exposed so you could check other genres. But I want scifi to be excluded from that display of terms when the filter is exposed.

I've never had much luck with the grouped filters, so any assistance on this would be appreciated.


texts:
On Drupal 7, I want all files to be served from a a subdomain of my site (eg. files.mydomain.com) for the simple reason that it allows a bit of flexibility going forward. So uploaded files, css and js caches, etc. would all be served from this subdomain.

The files are still located on the same server as Drupal and in a location writable by Drupal.

How can I do this?


texts: Is there a module/solution for allowing users to block each other on an SNS site?

texts:
Is there a module or solution that allows users to block each other on a social networking site?  For example, if a user blocks another they will no longer see that user's profile or any content posted by that user.

I imagine one could do something like this with the flag module, but it seems like it might get extraordinarily complicated...


texts: Set condition using rule module to pass one content type field's value in second content type

texts: I have created two content type Album details and Photos of album. In Photos of album content type  i added field (Entity reference type of first content type i.e Album details) and widget as select list. I set rule(Page redirect) on save button of first content type (i.e Album details) to second content type form (i.e Photos of album). As above mentioned about "select box entity reference" details of first content type is appearing as expected. My question is how can i achieve auto selected select box when i click on first content type save and come to second content type page. for more details please check two attached images.


texts:
I'm creating my own custom taxonomy rss feeds and have added those sucessfully to the head on term pages. Now, however, I need to remove the core taxonomy feed from those pages (currently it shows 2 feeds: the custom feed and the core feed).

Many people have suggested simply using the taxonomy view which overrides the core term and feed displays, but for complex reasons I can't use this solution.

I need to programmatically remove the feed from the head.

The original feed in the page head looks like this:

<link rel="alternate" type="application/rss+xml" title="RSS - termname" href="/taxonomy/term/2764/0/feed">

My best attempt to remove this is done in template.php and shown below, but it doesn't work:

mytheme_preprocess_page(&$variables) {
  //target taxonomy term pages
  if(arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric($arg2)) {
    $variables['head'] = preg_replace('/<link rel="alternate" type="application\/rss\+xml" title=".*?" href=".*?">/', '', $variables['head']);
  }
}

I probably need to get even more specific on the 'href' portion as well, so it only removes the term feed...but I haven't gotten that far yet.

I also tried adding $variables['head'] = drupal_get_html_head(); at the end just to reload the head, in case it was necessary, and that doesn't help.

How can I programmatically remove this feed?


texts: template_preprocess_HOOK: what do I put for HOOK?

texts:
My objective: get and change the breadcrumb within a custom module.

So it's possible that template_preprocess_HOOK is not even the best tool to be using for this, please mention that.

My question, though, is what HOOK to use? Should it be called template_preprocess_mymodule or template_preprocess_mytheme?


texts: I am using Drupal 7 Ubercart 3. Though I have added line item "Gift Wrapping" successfully using a module, I want to show it as well in the order "My Order" block so that the user immediately sees the fee in the order instead of seeing it on the review page. Please tell me is it possible to show line item in the cart along with other products?


texts: How to Import content without affecting existing contents

texts:
I have installed Data export and import

.i created nodes dataset file using above module and copied that file and pasted in another drupal site. when i import using that dataset file,it is replacing already existing contents. is it possible to import without affecting existing contents.


texts: Any suggestions for a adobe indesign like body field?

texts: I'm on d7. I am looking for any suggestions on modules that can give me the functionality to have a field that acts like adobe indesign. (For the purpose of this explanation I am going to call this my "canvas" field) I would like for my canvas field to be a container that holds text/images/videos/audio instead of just text like a body field would. I would like to provide my users with the ability to write some text in a something like a text box and be able to resize and position it where they want in the "container" field along with images etc. Does anyone have any suggestions? Even a combination of modules or something to get me started would be very appreciated. Thanks.


texts: How can get my site out of maintenance mode?

texts:
I moved my site from one server to another in the same way I moved another site. But it won't get out of maintenance mode.

I can access phpMyAdmin and I can access the server files easily.

I've tried /user and /q=user.

Any suggestions?


texts: Enable rest resource resource when module installs

texts:
I have a custom rest resource I have created within my module:

/**
 * Provides a Demo Resource
 *
 * @RestResource(
 *   id = "custom",
 *   label = @Translation("custom"),
 *   uri_paths = {
 *     "canonical" = "/rest/custom"
 *   }
 * )
 */
class custom extends ResourceBase {
public function get() {
    return new ResourceResponse("Response");
}

I have a rest.resource.custom.yml file in my module/custom/install folder to activate the end point when the module gets installed but it doesnt work:

id: module.custom
plugin_id: 'custom'
granularity: method
status: true
configuration:
  GET:
    supported_formats:
      - json
    supported_auth:
      - cookie

How do you enable rest endpoints when module is installed?


texts: How to delete all but the current revision from the field_collection_item_revision table?

texts:
I have a Drupal 7.24 Website making heavy use of field collections.

The field_collection_item_revision keeps getting bigger and bigger (9'000'000 rows) and only 200'000 entries are in field_collection_item.

What is the most secure and efficient way to "clean" this table?

PS: A SQL request with nested selects is not an option, it's too slow.


texts: How to get latitude and longitude from user with Form API

texts: I want to create a database-driven website with Drupal 6 to gather some information from users that is related to the location; I want to create a form (and I don't want to use Webforms, or CCK) to get some data from users, and to get coordinates by creating a point on a map (by Openlayers or Gmap API), and then saving those data in a database table. I also want to integrate it with Views module so i can make a query from data.


texts: Programmatically subscribing user to a organic group

texts:
I need to expose OG memberships within API functions calls and wonder how to programmatically subscribe a user to a group (pending state) and then i need to approve him programmatically and change from pending to member. Im using OG 7.2.

function ask_membership($uid, $gid){
  ????
}

function approve_membership($uid, $gid){
  ????
}

Any help appreciated


texts: I am working on this project, parking management system. I have the admin populating the parking slots available in the building. Then an anonymous user visits the site, puts their details and those of their car, and then in drop down selects a parking slot. The parking slots are an entity reference fetched from what the admin populated. How do I make the system dynamically populate this dropdown so that the user only sees the empty slots? Like after they book slot A, I want it to disappear so that the next person booking does not see it in the dropdown list of available slots. This is to avoid two or more people booking the same slot. The image below shows the drop down am talking about.


texts: How do I practically use the media library?

texts:
Now that Drupal 8.6 is released, I tried the experimental Media Library module. It works great, but it needs some additions.

How can I use core Media Library with CKeditor?
How can I fill custom fields added to media entities (images) on upload?

I can of course go back to entity embed, entity browser etc, but I wonder if this is already possible through modules or tricks that extend the core Media Library.


texts: How to prevent rules executing a rule after another rule was executed?

texts:
I have a Rule that does a few things when the user is first created ("After saving a new user account"), it interacts with a remote web service which provides a value, and then I save that value in a field of the user's account.

That "save" when the user is registered triggers the "After updating an existing user account" because it's also saving an entity property.

I have also rules that should trigger when the users are updated, but not when the previous rule created it!

I tried using a hidden value, but this doesn't help as I need to reset that value at some point and when I do, another "After updating an existing user account' is triggered!

Basically I need a way to tell a rule save an entity's property, user in this case, without triggering the "After updating an existing entity" or if triggered, avoid execution.

I am planning on working around this with a custom semaphore rules action that sets a static variable, but I really would like to know if there's a way of doing this properly without custom code.


texts:
I implemented the media browser module for image uploading and changed one of the image fields to utilise the media browser for a particular content type. After which, the views which displays a list of that particular content type is showing duplicate content.
After googling I found some one who had a similar problem to mine, however, I don't understand how he solved his problem. https://drupal.org/node/1764042
I would greatly appreciate any help given.
Thanks a lot.

Update:
Figured out the problem. I was using a file:usage relationship to generate the path url for rewriting the output. Hence having multiple files linked to that node would generate multiple views.


texts:
I have upgraded a site which had Internationalization installed.

After the upgradation, I tried to access www.mysite.com/fr and it led me "page not found" page.

I have enabled all the modules which comes with internationalization.

So is it with the configuration that the issue can be fixed or the drupal upgrade has not done properly.

Please let me know the correct steps to upgrade Internationalization to drupal 7.

Tks
Vil


texts: How to enable an authenticated user to vote?

texts: I am new to the field . I made a drupal 7 site using theme Danland, I am able to vote for the poll as an administrator but when I login as an authenticated user I can see the completed poll and I can not vote. What do I need to do.


texts: Is there a way to edit views fields in place?

texts:
I haven't tried the Editview or editablefields modules for Drupal 6, but neither is available yet for Drupal 7 anyway.

I'd like to provide a way for my users to edit lots of nodes and node fields on one screen, presented preferably to views. I'd rather they don't have to keep following a link (contextual or otherwise) to another edit form.

Any suggestions?


texts:
I need to create a table that will have a header with 4 columns and then all the rows will have 5 columns, so I need to add a colspan in the header.

This is an example of what I trying to do:

// The table header.
$header = [
  $this->t('Name'),
  $this->t('Description'),
  $this->t('Weight'),
  $this->t('Package'),
];

// The table.
$form['modules'] = [
  '#type' => 'table',
  '#header' => $header,
  '#rows' => [[1, 2, 3, 4, 5]],
  '#sticky' => TRUE,
];

This code just give something like this:

But I trying to obtain something like this:

I tried the last example in Add a class to a Drupal table cell containing ['data'] but just give some errors.

If you go to see the class Table you will see an example using the colspan in the '#wrapper_attributes' but it seems not works for the '#header'

I can obtain a similar output just adding an empty header column like this:

// The table header.
$header = [
  $this->t('Name'),
  $this->t('Description'),
  $this->t('Weight'),
  '',
  $this->t('Package'),
];

This will give something like this:

But I think that the correct way is adding the colspan property to the header.

Maybe I'm missing something or we just need to wait for Multi level (multirow) header for table FAPI element to use the colspan in the table header?


texts:
I've struck a problem that I can't explain and have no idea how to fix.

The symptoms of the problem are that clicking the Save button causes the page to refresh back to its original state. The Preview button behaves the same way.

The site is running drupal 7.22. It was working fine a few weeks ago but I can no longer edit or create nodes. To the best of my knowledge, nothing has changed by me.

I looked at the logs and there was no obvious errors. I noticed that Ckeditor was upset that ckeditor.js has disappeared from its correct location. This seemed unlikely but it wasn't there. I disabled Ckeditor.

Still no luck. The edit and add forms fail silently. This applies to as well as user's other content.

I don't think it's a database problem. For example, I can block/unblock user accounts from the list UI but not from the edit user page. I can perform module updates including DB updates.

Anyone have any thoughts how I can resolve this problem? All suggestions gratefully accepted.

Many thanks.

Steve.


texts: Install custom module into modules/custom folder

texts:
I've just made a facebook module, it's working nicely, the only thing is that it doesn't install into the modules/custom folder. The module installs into the modules folder (the custom folder is located inside this modules folder).

How can I make sure the module installs into modules/custom?

This is my .install file.

/**
 * @file
 * Install, update and uninstall functions for the facebooklikebox module.
 */

/**
 * Implements hook_uninstall().
 */
function facebooklikebox_uninstall() {
  db_query("DELETE FROM {variable} WHERE name LIKE '%facebooklikebox%'");
  cache_clear_all('variables', 'cache');
}

function facebooklikebox_update_6101() {
  // Get the default settings
  drupal_load('module', 'facebooklikebox');
  $defaults = _facebooklikebox_get_settings(TRUE);

  // Define a settings array based on the variables already set (or their defaults)
  $settings = array(
    'facebooklikebox_pageurl' => variable_get('facebooklikebox_pageurl', 0),
    'facebooklikebox_height' => variable_get('facebooklikebox_height', 0),
    'facebooklikebox_width' => variable_get('facebooklikebox_width', 0),
    'facebooklikebox_bordercolor' => variable_get('facebooklikebox_bordercolor', 0),
    'facebooklikebox_showfaces' => variable_get('facebooklikebox_showfaces', 0),
    'facebooklikebox_showstream' => variable_get('facebooklikebox_showstream', 0),
    'facebooklikebox_showheader' => variable_get('facebooklikebox_showheader', 0),

  );

  // If a setting matches the default value, unset it (we wont need to store it)
  foreach ($settings as $key => $value) {
    // We used to use -1 for disabled, convert this to 0 for the new diabled
    if ($value == -1) {
      $settings[$key] = 0;
    }
    // Now compare the value to the defaults. Only store if an "override".
    if ($value == $defaults[$key]) {
      unset($settings[$key]);
    }
  }

  // Save the settings in a single array rather than individual keys
  if (!empty($settings)) {
    variable_set('facebooklikebox_settings', $settings);
  }

  // Remove all the old settings
  variable_del('facebooklikebox_pageurl');
  variable_del('facebooklikebox_height');
  variable_del('facebooklikebox_width');
  variable_del('facebooklikebox_bordercolor');
  variable_del('facebooklikebox_showfaces');
  variable_del('facebooklikebox_showstream');
  variable_del('facebooklikebox_showheader');
}


texts: Update a Referenced Node with a value from the node referencing it

texts:
In Drupal 7, it was easy to update a referenced node with a value from the node referencing it, using rules: https://www.drupal.org/node/1836240

But how could I do the same in Drupal 8? This code is for updating a node programmatically:

use Drupal\node\Entity\Node;
$node = Node::load($nid);
$node->setTitle('MY NEW TITLE'); // This is a special meta field
$node->set('FIELD_NAME', 'THIS IS DATA'); // This is a Field added in to the content type
$node->save();

What hook should I call and place this code inside? I need when the user creates a new node or updates an existing node, then a field from the referenced node been updated with the value of a field from the current node. Should I use a form alter function? Is it possible with hook form alter to update, not only the current node, but also a field from the referenced node, or is there another hook for that?


texts: Replace user id with username in commerce order url

texts:
I have a token pattern set up in PathAuto to make user pages use the username in the url instead of the user id. Like this:

users/[user:name]

So it looks like "users/example_user" instead of "users/123"

In Drupal Commerce when I complete an order and then log in to view the order page, the path is like "user/123/order/456".

How can I make this path obey my user account page paths pattern and be "user/example_user/order/456"?


texts: Record video clip from webcam in Drupal 7 custom module

texts:
I want to capture the video clip from webcam in my own Drupal 7 custom module. Is there any way to capture the webcam and record the video clips in Drupal 7? Please, anyone can help me on this?

Thanks in advance.


texts: Cloned Sites and Original Site Are All Affecting Each Other

texts:
I am using Aegir to clone my Drupal 7 sites. I don't have any caching enabled on the original site.

When I clone the site everything appears to work correctly, however changes to the drupal database are mirrored between all my sites. For example, adding a new user will add the user to all the sites.

I have verified that separate databases are specified for each of the sites.

Any ideas what would be causing this?


texts: How to tell my custom block to not use placeholders/ lazy loading?

texts:
I have a custom block that renders a node's field's content. Now, when I type in random text in that field and kint in page.html.twig the region in which that block is rendered, the rendered output looks fine.

The problem is, when I embed a view via token filter in the node field, kint just returns a placeholder for my whole block (which eventually has other content than just that one view token).

As a result, I cant figure whether that region actually has content or not since Themes improperly check renderable arrays when determining visibility (I cant believe this is still a thing).

So, is there any way I can tell my block or that embedded view to not "use placeholders" but actually have the finished render output when I render it in page.html.twig?


texts:
I am working on a module where I need to save thousands or I guess millions of data (product'data from various e-commerce sites). So I am not sure of saving that data in a custom table by using custom entity or should I save that data in nodes?

As for searching, a user can use elastic or search_api_solr and use views for displaying the data, so is it better to use custom row or nodes to save that much of data?


texts: How to use Rules for sending an email to all users with same field value in some select list?

texts:
When users registers on my site, they choose their State of Origin.

Using Rules I would like to configure a rule which sends an email to all users from the same state when a user from that state edits his/her profile.

Is this possible using Rules or is there another approach?


texts: Why is this if statement not working in twig?

texts:
It's a bidirectional D9 site where I removed dir=rtl from my theme's html.html.twig with an if statement and it's working fine. I did that to avoid an MS browsers bug ignoring position: sticky in css if there was any dir="rtl" in either html or body tags. I did so in html.html.twig with this code:
{% if html_attributes['dir'] == 'rtl' %}

{% elseif html_attributes['dir'] == 'ltr' %}

{% endif %}

So now, when the site is in English (or any LTR lang) the html tag has a dir="ltr" attribute in it but none if the dir is rtl. That's working well.
I added the dir attribute to page.html.twig #page-warpper like this:
{% apply spaceless %}
{% if html_attributes['dir'] == 'ltr' %}

{% else %}

{% endif %}
{% endapply %}

 ......

This isn't working. Only the rtl direction is applied to the #page-wrapper regardless of the site's direction/ language. I added the spaceless filter later as I thought it might be an indentation issue but no change still.
I also tried this but not working either:
{% if html_attributes['dir'] %}

{% else %}

{% endif %}

Thank you for any views.
And sure, I did drush cr after each twig edit.


texts: Drupal Module - Mailing List, cannot export list, get browser error

texts:
I've just started using the mailing list module, but when I put it on my live site I get an error when I try to export the list of entries. I did get an actual Drupal error which is

    Error
The website encountered an unexpected error. Please try again later.

this put an entry in my Log which I followed up on the net and found this page http://drupal.org/node/1206916 entry #11 led me to a link which should fix this, I tried this, but now I just get a Browser failure saying it cannot locate the file.

any ideas? or is there a better mail module?


texts: Checkboxes, Radios, 'select or other' wont render inside table select element

texts:
I want to render elements of type checkboxes or radios inside tableselect, but what I get are empty html tags. Textfield and select type elements render fine.

Basically this renders fine.

$tableSelectTesting = array(
  '#type' => 'select',
  '#options' => array(
    "1000" => "$1000",
    "other" => t("Other"),
  ),
);

This does not.

$tableSelectTesting = array(
  '#type' => 'radios',
  '#options' => array(
      "1000" => "$1000",
      "other" => t("Other"),
    ),
);

I add the form element to table select using the 'data' array key.

$options[$index] = array(
    'column1' => $column1Data,
    'column2' => array(
      'data' => $tableSelectTesting,
    )
  );

This is the output I get for the radios element.

What should I be doing differently?


texts: Where are the "Replacement Patterns" (Tokens) in "Set Data Value" in Rules?

texts: Most of the actions in Rules allow you to use tokens, but seemingly the most obvious place where this would be useful, "Set a data value," does not seem to support it. Am I missing something? It seems like it would be pretty trivial to add support for this, but I can't find in the code why, for example, the "title" field in "create a new entity" supports tokens, but "Set a data value" does not. Thanks!


texts: What is causing this error message when using search module?

texts:
I have a website using drupal 7.  It has a site search that produces and error only when I search the word "application".

This is the error:

Fatal error: Cannot redeclare my_form() (previously declared in /home/leader40/public_html/modules/php/php.module(80) : eval()'d code:8) in /home/leader40/public_html/modules/php/php.module(80) : eval()'d code on line 257

Any ideas on how to solve this or why it's happening?


texts: Auto-create Nodes based on Content in current node?

texts:
In Drupal 7, is there a way to auto-create a node of "Type B" whenever a node of "Type A" has been created? Ideally, certain info would be passed on to the new "Type B" content item as well. For instance...

Let's say I create a new Type A content item, and that the Type A content type has several CCK fields. One of those CCK fields is a Node Reference field, which refers to content items of "Type C". Another of the CCK fields in Type A is a basic integer/text field.

When I create that new Type A content item, I choose "Content Type C Content Item #1" from the Node Reference drop-down select list. I also add "100" to the integer/text field. I'd then like a new Type B content item to be auto-created, with the same node reference info in its own node ref CCK field and the same integer/text in its own integer/text CCK field.

The purpose of this is to track usages of parts in sort of a macro and micro situation... Type C is the macro/master, Type A is the sub-macro/sub-master (if that makes sense) and Type B is the micro/slave of Type A. There will be many Type B's associated with a single Type A, but there will likely only be a single Type A content item associated with any given Type C content item.

I'm open to any all all suggestions, including scrapping this implementation concept in favor of something else that might work better and might be easier to manage.

Thanks!


texts: What is the difference between Translation language, Translation source, and Original language?

texts:
Would anyone be able to explain to me what the difference is between "Original language", "Translation language", and "Translation source"? I think I have a pretty good idea, but for example I've added all of the above to my content overview admin view, and I translated one entity from English to German. The row for that translation in the overview table has:

original language -> German
translation language -> German
translation source -> English

Translation language and Translation source I assume is the language content was translated to, and Translation source was what content the translation was derived from. So, is Original language just the language that the specific content was created in? If so, how does Original language differ from Translation language? Thanks for helping me understand.


texts: Showing unpublished content to the anonymous creator

texts:
I am working on a Drupal 7 module called Anonymous Publishing.  In brief: It lets the anonymous user create posts.

The anonymous user create contents using the standard content creation node_form.  When the user press save, Drupal automatically creates and loads the node.  However, since the node is unpublished at this point, the user just gets an access denied message.  I want to avoid this, and instead show the user the node just created.  I've so far only managed to do this with this rather nasty kludge in a hook_node_grants():

$result = db_query("SELECT created FROM {node}
   WHERE nid = :nid", array(':nid' => $nid))->fetchField();
$delta = time() - $result;
if ((0 == $account->uid) && ($delta < 20)) {
  $grants['anonymous_publishing'] = array(1);
}
return $grants;

What the above code does is this: It checks the age of the node, and if it was created less than 20 seconds ago, it grants the anonymous user the right to view it.

While this works (sort of) it is ugly and it may even expose the content to someone else if there is another anonymous user around that requests the content within the same 20 second window.

Any suggestions for a better solution?


texts: Access By Term(abt) is not work in SOLR search Drupal 7

texts: I'm using Access By Term contrib module which is used for show the node when the node term reference and the user term reference is equal. I can get this, Also in solr search, Filter tab setting I have enabled the Node access checkbox. However when I'm searching the particular node title with other user credentials, actuallay the other user cannot be able to search those nodes. Still solr search resulting a node. I want to restrict this??? Is there any way??


texts: Administrative theme doesn't work for users who aren't administrators

texts:
I have a theme for the frontend and I use "seven" for the backend as I set it on admin/appearance.

I created a new role: "power user", which is a limited access to the different content types. The "power user" role has access to the "View the administration theme" permission.

I created a new user, assigned it to the "power user" role and when I edit a content then the page is displayed by my frontend theme instead of the admin theme.
I tested it on 2 different drupal systems with same results: 8.3.1 and 8.3.4.
The admin theme works for the "administrator" role.

Any idea how can I fix it?

Is this a bug, or there is something else that I forgot to set up?


texts: Theme the landing page after saving new content

texts:
I have a content type Testimonials and like any other type, it gets displayed after you save it. Is it possible to theme that page into something that says Your Testimonial has been saved! instead of displaying the data? I only need this for this specific content type.

EDIT: @googletorp
Am I doing this correctly? I placed this code in my custom module enchance.module (activated) but I'm still getting the same page: the full version of the published testimonial instead of being redirected to <front>.

function enchance_form_alter(&$form, &$form_state, $form_id) {
    //dpm($form);
    if ($form_id == 'edit-testimonials-node-form') {
        $form['#submit'][] = 'testimonials_redirect_success';
    }
}

function testimonials_redirect_success(&$form, &$form_state) {
  // Use the drupal_set_message solution.
  drupal_set_message(t('Your Testimonial has been saved!'));
  // Redirect to custom page solution
  $form_state['redirect'] = '<front>';
}

// I'm not being redirected to <front>


texts: Redirect to a content page after login only from that page

texts:
On one certain page of my site, users have to log in before going any further. They don't have to be logged in to see most of the rest of the site content, but on this one specific page, they do have to be logged in. I figured out how to put a barrier up that forces users to log in before seeing that page's content (i.e., if users aren't logged in, the only thing on the entire page is a line that says "To create content, you must first log in" and there's a link to the login page), but how do I redirect newly logged-in users directly back to that same page (which now will have content on it) so they can now see its content?

At the moment, after they log in, it just takes them to their profile page.

In other words, if users log in on any other page, it's fine if they're redirected to their profile page, but on this one specific page, they need to stay put. I've seen lots of variation of the following code:

function hook_user_login(&$edit, $account) {
drupal_goto('node/1');
}

But I don't think this is what I'm trying to accomplish. The current code I have in there looks like this:

$sample1 = 'log in.';
$sample2 = 'To create a classified ad, you must' . " " . $sample1;

global $user;
if ($user->uid == false){
return $sample2;

}

I've seen some code like this that looks promising:

#action' => url($_GET['q'], array('query' => drupal_get_destination()))

But I can't figure out how to make it work. Anyone got any ideas?


texts:
I have setup multiple new view modes for a specific node. Full,Teaser,New Teaser,Custom Display.

Is there a way to view the same node with different URLS for the different view modes. Please let me know if i need to explain further.

Hopefully this makes some kind of sense.


texts: How to list all fields of a content type with views?

texts:
I would like to create a product comparison view. Each product has lots of features which all need to appear in the comparison view. Each feature is a separate field in the “product” content type.

Instead of manually adding all fields of the “product” content type to my view, I’d like to have all fields added automatically to the view – for example when adding a new field to the “product” content type. Is this possible?

Bonus question: can I add all fields to the view by default and later exclude only a few of them?

Edit: Further Notes

I’d like to create a comparison table where corresponding features appear in the same row with a single row/column label for the feature. Many features are optional, though. Therefore I need the feature fields of the “product” content type to be available as separate fields in the view – so that I can properly align them in the table.


texts: How to edit a web form value so that the column name can be as required in a table in UI

texts:
I have a submissions form where I am displaying all the form submissions in a table with custom columns, which I build from my form elements I created. But also I am using an built-in drupal column called 'completed', which will display the date and time of the submissions. I need to edit this column name to 'submitted at'.

I tried theme_table and module_table methods to edit the value but I am not able to hit those methods. When I tried hook_form_alter I am not able to see the table values when I did var_dump($form) to edit them in form[] array. I kept knit(_context) in the twig file of the table and I am able to see the values of the table and the value is coming from _context->few layers  Drupal\Core\Template\AttributeString.

How do I use this info in form_alter or any other hook to edit that string value?

Like I don't know how to use _context array in form_alter method. when I tried form['_context'] its giving me null.


texts:
im creating website for racing events, basically website have added all races that are happening during one year, and it stores data for previous races. I was asked to move from website from .net N2CMS to Drupal.

Im having problems with setting up proper content types and their references.

In the old website they have added several races. Every race node contains basic details ( town, country, best time, website url... ) and besides that details every race have data about previous years winners ( Name, Timings, Car ).

On the main race node there is this basic data and bellow that there are results from latest 5 years with ability to expand and show all previous years.

So its clear to me how to make main race content type and add fields, but i was wondering how to make it easy for admin to add winners of previous years, and this has to be modular as much as possible, because some races have this data all the way down to 1972, but yet some of them have just few years back.

So i guess some kind of node reference should be used here but just dont have it clear in my head what i need to do.

Sorry if my questions is not clear, i tried to explain it so that everyone can understand it.

Thanks


texts: How do I add a token for upcoming or past event?

texts:
How do I create/find a token in Drupal 7 that determines if the date value is past today or not (i.e. upcoming or past)?
I'm creating a map using Views and Leaflet, and I'd like to change pin color based on if date is past today or not.


texts: Using entity reference field as filter in view

texts:
I have a content type 'Player' which has an entity reference field to the content type 'Tournament'. The entity reference field allow multiple values (a player can join several tournament).

I'd like create a view of all Player nodes filtering on the 'Tournament' field. When i try to add the entity reference field as filter nothing happens (I have installed the 'Views Reference Filter'). I need also to expose the filter to the users using a droplist.

Can someone help  me? Thanks


texts: Adding ASCII characters to HTML links in Drupal

texts: I've written the decimal HTML entry of the "Logical or" ASCII note in a menu-link and yet I don't see the character. What I do see is the decimal HTML entry... Why is that? Is this problem solvable without any modules? Thanks,


texts:
I'm using Drupal 7.28 and Views 7.x-3.7.

I've created a vocabulary called Products and listed terms under this including Living, Dining, Storage, Office, Outdoor.

I've also created a content type called Products with an auto term reference for users adding content to select one of the terms.

What I want to do is create a view that will automatically create a page for each of the terms, so in the menu it will have for example Living, Dining, Storage, Office, Outdoor etc. I don't want to have to create a new view each time a term is added.

Then, if a term has been added but there is no content that has selected a term the page will just say 'No products' (which i know this bit can be done by setting a No Results behaviour.)

Thanks very much for reading.


texts: How to filter content by a specific taxonomy term when vocabulary allows multiple values?

texts:
I have defined a vocabulary that allows multiple terms to be checked for a Content Type and I would like to create a View that could gather all the data from that Content Type but grouping the results by a specific term.
When I'm not applying any contextual filter, the result list should contain a group of data for every term in my vocabulary. Naturally, some of the items will appear in multiple groups because of the multiple terms scenario.
I would like to create a contextual filter for a specific term and get as a result only one of those groups. The problem is that I'm getting not only the group I expect but other groups in which some of the results have more than one term selected for the same vocabulary.
For example:

Content type is "Dogs".
Vocabulary is "Places".
Taxonomy terms for "Places" are: "Kitchen", "Living room", "Garage", "Outside".

"Dogs" has a field called "Places to play with my owner" which is related to "Places" and the user can select one or more options.
I created a view that has:

A relationship with "Places" vocabulary.
A contextual filter that retrieves all the "Dogs" that play on each of those places when there is no specific term to filter.
A field group using the "Places" term names.

And retrieves the following results on a URL like: /dogs/places-to-play/:

Kitchen: Dog A, Dog B.
Living Room: Dog A.
Garage: Dog C.
etc.

The contextual filter should receive a "Places" term name via URL like: /dogs/places-to-play/kitchen and the expected result would be:

Kitchen: Dog A, Dog B.

But in my case, the results are:

Kitchen: Dog A, Dog B.
Living Room: Dog A.

Because "Dog A" has options "Kitchen" and "Living Room" selected in its "Places to play" field.
The question is: Is there a way to avoid getting the extra groups?
Thanks in advance.


texts:
I have a text field. When I enter text in the CKEditor the words look OK. But when I look at the rendered page, it seems as if Drupal has split all word instead of put the entire word in the next line.

For example the word "Materialien" in the screenshot is split and this is not correct. I tried the CSS word-break property, but it seems that something is coming from Drupal and is breaking all the words.


texts: add shipping information programmatically

texts:
I want to add shipping information to order programmatically(I have some policy for it),how can I do it?

my idea is  add submit handler in form ,then load profile and set it in form_state values but not worked and it only has default profile information of that user (profile_id different with 3)

my code :

function chapboodev_form_alter(&$form, $form_state, $form_id) {

    if($form_id=='commerce_checkout_form_shipping'){

//        drupal_add_js(drupal_get_path('module', 'chapboodev') . '/chapboo_refresh_block.js');
//        unset($form['customer_profile_shipping']);
//        hide($form['customer_profile_shipping']);
        $form['buttons']['continue']['#submit'][]='chapboodev_custom_sub';
        ym($form);
    }
    //    ym($form_id);
}

function chapboodev_custom_sub($form,&$form_state) {
        $form_state['values']['customer_profile_shipping']['customer_profile']=commerce_customer_profile_load(3);

}


texts: Drupal add class to body if page is unpublished

texts:
I would like to be able to add an unpublished class to the body tag of a node (for both its main view and edit view) if the node has been unpublished.

How can I do this?

Steps I have taken:

1) Node Object
The node object contains if a node has been published or unpublished (with $node -> Status), but I am not sure how to test this for each node and then add it to the body class.

This question is similar, but the provided answer doesn't work.

2) Drupal 6
This page explains how to do it for Drupal 6, but the code doesn't work for Drupal 7.


texts: How to import git commit from development to testing in Aegir

texts:
So, I have established Aegir to take care of my sites workflow.

Now I made changes to my development site, used git to load the commit to development site. How do I import the latest commits to Staging or Production ?


texts:
It appears that some things have changed with Drush. I have a project that is reactivated, and we did updates, but somewhere along the way that file is lost. Before solving some fatal error glitches, I need to try and create another backup, but that glitch is preventing me from getting to the admin page to do an export. (/admin/config/development/configuration/full/export)

I need to solve some fatal errors I'm getting, but before I go any further, I'd really like to create a tar of what I've got, and it no longer seems possible.

Is there a way to create a tar of the site from composer? If so, what is it?


texts:
I have created one form. In function buildForm() I'm firing query by getting parameters from url.

So suppose my url is [example.com/myform/myshort-title][1]

Now during form build, it gets the default argument as url parameter, and render results of query.Let's say my query result is an array of entity ids.

$entityids = array(1,2,3,4,5,6);

public function buildForm(array $form, FormStateInterface $form_state, $short_title = '') {

$query = \Drupal::entityQuery('mycustomentity');
$query->condition('colname', $short_title);
$entity_ids = $query->execute();

}

Now in  form submit handler, I'm rebuilding form state like shown below:

class MyForm extends FormBase {

  protected $myvar;
  protected $step;
  protected $correct_ans;

  public function buildForm(array $form, FormStateInterface $form_state, $short_title = '') {

    $query = \Drupal::entityQuery('mycustomentity');
    $query->condition('colname', $short_title);
    $entity_ids = $query->execute();
    $i = 0;
    foreach ($node_storage as $nodeID=>$nodeData) {
       if ($i == $this->step)  {
echo $this->correct_ans;

       $correctAns = CategoryController::getCorrectAnswer($op,$entityid);
       $form['answer'][$i] = array(
            '#type' => 'hidden',
            '#value' => $correctAns,
      );
     }
    }

    }
public function submitForm(array &$form, FormStateInterface $form_state) {
$aString = $form_state->getValue('answer');
foreach ($aString[0] as $key1 => $value1) {

                         $this->correct_ans= $value1;

}
   $form_state->setRebuild();
   $this->step++;

    }

}

Debugging results give:

At first, when form gets loaded, it takes default parameter as argument from url == short_title.

print_r($entity_ids); gives array(1,2,3,4,5)
print_r($correctans); echo "<br>";gives arary(0=>myanswer1)

Hit Submit

  array(1,2,3,4,5) array(0=>myanswer1)

  array(1,2,3,4,5) array(0=>myanswer1) array(0=>myanswer2)
  array(0=>myanswer1) array(0=>myanswer3)

and echo $this->correct_ans; always gives myanswer1.
On every form submit form gets rebuild and $this->correct_ans takes default array value which is array(0=>myanswer1)

But I want, On first submit, I get array(0=>myanswer1), On second submit I want array(0=>myanswer2), On third submit I want array(0=>myanswer3) and so on...

Where I'm doing mistake?Please help.


texts: Is it possible to disable the superfish accordion 'main menu' link at the smaller responsive sizes? Instead of clicking on 'main menu' to see the navigation, I would like the navigation to already be expanded without having to click on a link. The navigation should go from the horizontal menu directly to the vertical menu.


texts:
I need to add short descriptions for some 20+ views and display them above the views. I know I have an option to add a header to a view, but that's not what I want. I have a sidebar on the left and the main content on the right which displays views on the views pages. I need to add different descriptions for my views ABOVE both sidebar and main content.

How do I achieve it?


texts: drupal_set_title not setting $title variable

texts:
I'm trying to use drupal_set_title() in my node.tpl.php but the text I'm setting the title to is only showing up in the $head_title (html.tpl.php) variable and not the $title variable. The $title variable is still set to the node's title.

This is in Drupal 7. I've used drupal_set_title() multiple times like this in Drupal 6 and it has worked perfectly.

Is this broken in D7?

This is how it is being used in node--news.tpl.php:

$actual_title = $title; // save for later use
drupal_set_title('News');


texts:
I am sorry for the vague question but I have no idea about where to start.

Please think of a scenario that, you created a video content type and you want your site visitor either upload their video files to your site, or they use the embed codes from any third party providers (youtube, vimeo etc.). For the sake of providing a clean GUI, you do not want to show both fields, but based on the choice of your user (maybe an image combo), you either show the file upload field or text area field (where they put the embed code in)

My question is, I wonder if there any elegant way to do it in Drupal without making any PHP, HTML or CSS modification?


texts:
If you use the messaging system in Drupal.org, you have noticed that if you go to your messages, there may be a link that says New Message next to the thread.

We have Q&A section where people ask questions and others leave comments.

What is the proper field to add in views that will show "New Message" or "X new messages". The notification will be to the login user only.


texts: Access control for announcement users to view via link

texts:
Is there a module available or anyone have a hint as to how one could create private links? I have a site that is locked down via access control, but I would like to send an announcement user a link to be able to view that piece of content.

Sort of like a Dropbox share. I can elaborate more on my use case if needed.


texts:
This question is related to two issues on drupal.org:

Standard profile: make "Home" menu link to  editable/deletable
Orphaned menu items should support removeDefinition

Summary

How to delete a menu item that was defined in example.links.menu.yml and then changed, for example by disabling it or changing its weight.

Steps to reproduce

Install a clean Drupal 8 with the Standard installation profile
Go to admin/structure/menu/manage/main and disable the Home menu item. This change will write the menu item to core.menu.static_menu_link_overrides.
Delete file core/profiles/standard/standard.links.menu.yml
Clear cache
Try to delete the now orphaned menu item:

$home_manager = \Drupal::service('plugin.manager.menu.link');
$home_manager->removeDefinition('standard.front_page');

Expected behavior

We are able to delete the menu item.

Actual behavior

We get the following error:

  Uncaught PHP Exception
  Drupal\Component\Plugin\Exception\PluginException: "Menu link plugin
  with ID 'standard.front_page' does not support deletion".

Question

Is this a bug in Drupal core, or am I using the wrong way to delete the menu item?


texts: What are some drawbacks/benefits of using ctools?

texts:
What is the purpose of ctools?

Are there any drawbacks in using ctools for one's programming needs?
Also, what are some benefits to using ctools? From the project page it seems to just be a large collection of random tools.


texts: How to add password reset link to user page?

texts: Is there an easy way to add a password reset button to the user page in drupal 8? For user management I need the admin to be able to send password recovery link to users AFTER the user account is created. This button should only be visible to admins.


texts: Is it possible to filter content based on existing term id?

texts:
How to filter content based on taxonomy term id
I have created a view in which news article are showing based on taxonomy term

Is it possible to filter content based existing term id

Suppose in view when i am filtering content with term id 23,24 its giving me result.

But when i am filtering content with 23,24,25 ,where 25 is randomly assumed number its still filtering content on the basis of 23,24 term id

Can we restrict content to filter.


texts: do some action when order status is changed to complete

texts:
In drupal commerce I want the rules module to do some action when the order status changes to completed. In fact, after buying some product an order is added to order list. Then, what I need is that when the moderator comes and change the order status to completed the order owner get permission to see some content type.

I have tested these rules but none of them worked!!

Event: After updating an existing commerce order
Condition: Execute custom PHP code

if([commerce-order:status] == 'completed') return TRUE;
else return FALSE;

or this one:

Event: After updating an existing commerce order
Condition: Data comparison

Parameter: Data to compare: [commerce-order:status], Data value: Completed

or this one:

Event: After updating an existing commerce order
Condition: Data comparison

Parameter: Data to compare: [commerce-order:state], Data value: Completed

In fact, without adding any condition the reaction is done after adding an order by customers (do not wait for moderators to complete the order) and with any of these conditions, rules never fire and the is reaction never done.


texts:
I put the following code into the bock content box and set the input type to Full HTML; then I enabled it on page--front.tpl.php. When I viewed the HTML source, I
saw the  label contained a
 tag.

test

      Fujia Chanpin 01

test

      Fujia Chanpin 01

test

      Fujia Chanpin 01

test/strong>

      Fujia Chanpin 01

test

      Fujia Chanpin 01

test

      Fujia Chanpin 01

test

      Fujia Chanpin 01

For example, for the last list item, the output was the following.

tsdet
Fujia Chanpin 01

Why is there a
 tag where I didn't add it?


texts: Determine available Entities entity_metadata_wrapper value() methods

texts:
I'm struggling to determine which entity_metadata_wrapper methods are available for a given field.  For instance:

<?php
  $fields = entity_metadata_wrapper('node', $nid);
  $body = $fields->body->value->value();
  $title = $fields->title->value();
  $type = $fields->type->value();
?>

$body has a different method, where you have to do a ->value->value() for it to work right.

In my situation I'm trying to get the type of the node in Human readable form: "Custom Type" vs. "custom_type".  I'm wondering if there is some kind of value() method that returns the human readable version.  print_r($fields) avails me not.

Edit: To get the Human readable node type I ended up just using node_type_load.  It seems like there should be a more efficient way of doing this using the Entity API, but I can't figure it out.


texts: Cannot access commerce order relationship in Add relationship form in Drupal 7 Views

texts:
I have Drupal commerce installed on a Drupal 7 website. I needed to create a view of users and wanted to display the product type they had purchased along with the user name in the View. However I am unable to create a relationship between the view and commerce order even though the module (commerce) has exposed it via hook_views_data

'relationship' => array(
  'title' => t('Owner'),
  'help' => t("Relate this order to its owner's user account"),
  'handler' => 'views_handler_relationship',
  'base' => 'users',
  'base field' => 'uid',
  'field' => 'uid',
  'label' => t('Order owner'),
),

Can anyone point out what is causing this relationship to not appear in the View add relationship foorm? Is it required to modify any additional configuration settings to bring up this view?


texts: Getting configurePhpcs is not callable after update drupal to 8.3.2

texts:
I updated drupal with composer composer update

Drupal is updated to 8.3.2 but when I install modules I get anytime this message

Method Drupal\Core\Composer\Composer::configurePhpcs is not callable, can not call post-auto  load-dump script

how to make configurePhpcs callable again?

Website is still working,


texts: Drupal, how to display only specific content

texts:
I'm on Drupal 7, I have a menu like :

HOME
NEWS
BLOG

For now, when I click on HOME, i can see all contents.

I want, when I click on NEWS, redirect the user to /news and only display contents of type NEWS. I want exactly the same for BLOG

I have no idea how can I do that.

Thanks !