texts:
I am creating a custom field and I am looking to get the value of a textfield during node creation. In the callback I need to get the value of the textfield, how do I do this?

function field_zoekproduct_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
      switch ($instance['widget']['type']) {
        case 'field_zoekproduct_field' :

          $element['searchfield'] = array(
            '#title' => t('Zoek naar een product'),
            '#type' => 'textfield',
            '#required' => TRUE,
            '#maxlength' => 115,
            '#size' => 55,
            '#weight' => 0,
            '#default_value' => 'zoek...',
            "#executes_submit_callback" => FALSE,
            '#attributes' => array('onfocus' => "this.value = '';"),  //when textbox gets focus the default value will be removed
            '#ajax' => array(
                  'event' => 'change',
                  'callback' => 'zoekproduct_zoek_getypte_text',
                  'keypress' => true,
                  'wrapper' => 'dropdown-second-replace',
                ),
        );

  return $element;
}


texts: Specific localization server for a module

texts:
Hello fellow Drupal developers...

When installing a new language, the Localization Update module downloads the necessary (.po) files from Drupal's localization server.  However, is there a way to specify where a module should download this from?

This shouldn't be for ALL of the modules, but only a package of modules or just one single module.

Is there a hook, or some sort of info configuration we can place in the module's .info file?


texts: How to add others libraries such as Zenpen to WYSIWYG profiles?

texts: I would like to use an editor for Drupal like Zenpen. Is it possible to add that library (Zenpen) to WYSIWYG profiles?


texts: drupal 7 profile 2 how to create field profile url as NAME

texts:
Why is it so hard to create a view so others can see it? I just read the instructions at dupal.org documentation and checked out ep#33 of daily dose but neither are helping.

My view is set up with a grid of fields filtered by type main profile. I can't get the names as link to profile; all I can get is profile:url which looks ridiculous.

How can I get my profile:url field to be the link for a name?

[url] == Profile: URL   <--- how is this inputed for replacement field?


texts:
I have a website built on drupal with search functionality. When I search for example for "test" the link of the search is displayed like search/node/test

Is there any possibility that if I call search/node/test?json or search/node/test/json the returned page would be plain text in json format of node ids ?


texts: Field for additional charge the drupal / drupal commerce way

texts:
What is the canonical drupal commerce way of storing data for say something like an additional charge?

Would it be a price field / text field / Line item field?

I would like the field to store data like this:

label: color charges
desc: field stores the additional amount for a color foobar product
number of values: 1

example value: 0.75


texts: How to provide option to select geographic part for content

texts:
I'm working on Drupal6 travel website and stuck with how to provide option to users to select the right geographic part of the world that they are going to write story about that place.

Should I provide AJAX drop down for example:
1 - Countries  (So when user select country)
 then
2 - Cities/States (Related to the selected country)

If there is something else for that ?

Any help would be appreciated :)

Zafar


texts: Get author id in field template - or make an edit button on a node's teaser

texts:
I am using Display Suite to display Teasers of a custom content type Project in a View.
I want to show link on each Teaser to edit that node if the logged in user is the author of the node.
Our requirements do not allow us to use Contextual Links with the little hover gear.

Things I have tried:

I was also able to make a Display Suite field for [node:author:uid] and display that field in the Teaser.
I was able to create a Display Suite field to hold the link and display it in the Teaser.
I was able to create a custom field template for that Project Edit Button field I just made and display it in the Teaser. field--field-project-edit-button.html.twig.
This is where I hoped to wrap the content of that field (the link) in a conditional statement.

However

In the past I have been able to access fields in a different field's template using this technique. {{ element['#object'].field_name.value }}
I was able to do this with a Display Suite field for [node:nid] and then do {{ element['#object'].nid.value }} (where nid is the machine name of my [node:nid] Display Suite field) in the Project Button field template above.
It also works to use it in a conditional statement like {% if element['#object'].nid.value == 6 %}.
But this same technique is not working with {{ element['#object'].aid.value }} (where aid is the machine name of my Display Suite 'Author ID' field). It just comes back empty.

So

What is different about my [node:author:uid] and [node:nid] fields?

Why am I seeing the actual Author ID field properly but not {{ element['#object'].aid.value }} in the edit link's field template?

How do I make this silly button? I am completely open to other ways of doing this as long as it meets my requirements at the top of this post.

FULL SOLUTION, thanks to No Sssweat below

Display Suite token field:

 Edit [node:title]

In the .theme file under mytheme_preprocess_field

/* Make the current user id available in field templates */
$vars['uid'] = \Drupal::currentUser()->id();

In that custom field template:

{% if element['#object'].getOwner.uid.value == uid %}
  {% for item in items %}
    {{ item.content }}
  {% endfor %}
{% endif %}


texts: Creating simple user groups with a term in Drupal 7

texts:
I need to tag my users as belonging to a 'workplace'. And then display a page with workplace details and a list of associated users.

I have setup a vocabulary in Taxonomy called 'workplace' and I can easily tag a user. I need to know how to create a block that will show on a taxonomy / term / id page and show tagged users.

I imagine I will have to make part of the user details public as well as by default they won't be?

Any help much appreciated - even a hint as to where to start ...


texts:
I do not have much experience with Drupal but I have a question.
I have a content type Hotels with general information about the hotel but also with a field country and country information.
I was thinking to make a content type Country with fields like country information (country Name (England), country description (England is an island), map (googlemaps).
So when I have to add 10 hotels in the same country I do not have to write the same country information again and again.
I want to combine the content type HOTEL and COUNTRY but I really don't know how to do it?


texts: New custom content type not showing up in 'Create content' menu

texts: I have created some new content types but they automatically don't show up in the 'Create content' menu - what do I have to do to get them there. I am currently logged in as user 1 so it shouldn't be a permissions issue.


texts: Remove login confirmation message programmatically

texts:
I have the login form displayed in the CTools modal dialog. When users log in, they see the confirmation message and a Rules action redirect them to the home page.
How can I remove the confirmation message without using the disable_messages module?


texts:
Scenario

"landing page" content type, with node 1 at path node/1
corresponding menu item A (with path node/1)
children menu items of this menu item, B, C, D (with arbitrary paths http://google.com, zee/bang, and node/1234)

Objective

Build a view which displays on node/1, whose results are links B, C, and D.

In Drupal 7, i would have used https://www.drupal.org/project/menu_views to accomplish this.

How best to achieve this in Drupal 8?


texts: How can I display a Google map with Search API Views and Search API DB

texts:
I am using Search API with Search API DB, and Facets, with Search Views.  I want to display a map to plot the results from the search.  Is this possible?  I have looked everywhere and can't seem to figure it out.

My nodes currently use geofield for the individual node pages.


texts: How to upload a static copy of a pages HTML to S3

texts:
I have a need to upload a copy of a rendered output of a URL to Amazon S3 when it is edited and published.

By this I mean if I was to edit /brand-a/page-1 on a site, I would like the full rendered output of that page as seen by an unauthenticated user to be uploaded to /brand-a/page-1 in a S3 bucket. Essentually using Drupal as a content publishing platform offloading all delivery to the end user to Amazon S3.

I am comfortable using the Amazon S3 + AWSSDK + Libraries plugin for handling of media, I have not been able to find a plugin that covers off my requirements highlighted in red in the above diagram.


texts: Warning: file_put_contents(temporary://): failed to open stream

texts:
I get this message from Drupal:

Warning: file_put_contents(temporary://file8vyLsO): failed to open stream: "DrupalTemporaryStreamWrapper::stream_open" call failed in file_unmanaged_save_data() (line 1900 of /home/donatelo/public_html/thenameofthesite.com/includes/file.inc).
The file could not be created.

I don't know what I did to cause this, can anyone help me?


texts: Getting error {"message":"No route found for \u0022GET \/standortimporter\/region_node_rest_resource\u0022"} custom rest POST

texts:
I am creating custom rest resource using this code:

<?php

    /**
     * Provides a resource to get view modes by entity and bundle.
     *
     * @RestResource(
     *   id = "region_node_rest_resource",
     *   label = @Translation("Region node rest resource"),
     *
     *   uri_paths = {
     *     "canonical" = "/standortimporter/region_node_rest_resource"
     *   }
     * )
     */

 namespace Drupal\standortimporter\Plugin\rest\resource;

use Drupal\Core\Session\AccountProxyInterface;
use Drupal\node\Entity\Node;
use Drupal\rest\Plugin\ResourceBase;
use Drupal\rest\ResourceResponse;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Psr\Log\LoggerInterface;

    class regionNodeRestResource extends ResourceBase {

      public function post() {

              $node = "hello here";

      return new ResourceResponse($node);
      }

    }

And getting this error:

  {"message":"No route found for \u0022GET
  /standortimporter/region_node_rest_resource\u0022"}


texts: Loading a specific node revision for view

texts:
I am trying to load a specific revision for viewing by the end user. Drupal 7.

I have the following in my .module ;

function mymodule_node_load($nodes, $types) {
  if ($nodes[821]->vid != 5928) {
    $nodes[821] = node_load(821, 5928);
  }
}

function mymodule_node_view($node, $view_mode, $langcode) {
   $node = node_load(821, 5928);
}

If I dpm/var_dump the node after doing this, its perfect and is the correct revision but when it comes to rendering, the page chooses the older revision. So something is happening between these functions and the page rendering. What is it? And how can I stop it?

Thanks in advance, much appreciated.

EDIT Anybody know if there is a hook load order chart somewhere? That would be super handy.

EDIT #2 It seems that even the node.tpl.php has the correct revision but what is displayed is not the correct revision ... See image (body['und'][0]['value'] != what is displayed.)

EDIT #3 Ok, so I worked out how to do it (code below) its an awful solution and its because of this that I am going to have a look at the Workbench module because I think it might just do what I need. Thanks for all the help!

/**
 * Implements hook_node_view_alter().
 */
function mymodule_node_view_alter(&$build) {
  $latest_revision = _get_latest_published_revision($build['#node']);

  if ($latest_revision) {
    $build['#node'] = node_load($build['#node']->nid, $latest_revision);
    node_build_content($build['#node']);

    $build['body'] = $build['#node']->content['body'];
  }
}


texts: Wrapping a rendered file from Media with a link

texts:
This is a question related to How to set Media Styles in Media 7.1.2 / Media 7.2.X?.

I am using Media 1.2 in a Drupal 7 site to add some fields to images (caption, credit, etc).

If I have an image field set up to display as a Rendered file with a particular view mode, eg

I have my display set up the way I want to show the proper fields for this view mode.  In the file display, eg

is there a way to wrap the image in a link to the media/fid page?  I am not seeing how to do this from the UI, and Theme Developer isn't giving me any useful info for which theme functions and preprocess/process functions are being invoked between the one for the whole image field (as far as the content type is concerned) and the image itself (the actual <img/> element).

At this point, I do not want to switch to Field Collection, but would entertain switching to Media 2.x if that is my only option.


texts: How to programmatically create an exposed filter?

texts:
Is there a way to create programmatically exposed filters in Drupal 7?

I searched a lot but I found only topics related remove or alter exposed filters already available in a view.

By instance my view doesn't provide any exposed filter.
I must create it through the code in my module.
I have a view but I can't change it via Views administration interface.
I must achieve the result by implementing hook_views_pre_view() and add_item().

Unfortunately add_item is not very well documented or, at least, not the part concerning the $options array structure.

Given 'field_status' a "select list" with 3 items defined in the field configuration, and the following piece of code:

 function hook_views_pre_view(&$view, &$display_id, &$args) {
   $field = field_info_field('field_status');
   if (!empty($field)) {
    $filter = array(
     'identifier' => 'field_status',
     'exposed' => TRUE,
     'is_grouped' => FALSE,
     'table' => 'field_data_field_status',
     'type' => 'list_text',
     'expose' => array(
       'operator_id' => 'field_status_value',
       'label' => 'Status',
     )
   );
   $view->add_item($view->current_display, 'filter', 'field_data_field_status', 'field_status_value', $filter);
   $view->display_handler->set_option('css_class', 'view-status');
}

what should be the structure of the array $options (in my case $filter)?

As a result of this I can see the submit button 'Apply' and the label "Status" in an empty widget 'div'.

Here is the code edited following suggestions in comments:

function my_module_views_default_views_alter(&$views) {
  if (array_key_exists('my_view_name', $views)) {

    $options = array (
      0 => 'Blocked',
      1 => 'Active',
    );

    $display = $views['my_view_name']->display['my_view_page'];

    $display->display_options['filters']['field_status']['id'] = 'field_status';
    $display->display_options['filters']['field_status']['table'] = 'field_data_field_status';
    $display->display_options['filters']['field_status']['field'] = 'field_status';
    $display->display_options['filters']['field_status']['exposed'] = TRUE;
    $display->display_options['filters']['field_status']['expose']['operator_id'] = 'field_status_value';
    $display->display_options['filters']['field_status']['expose']['label'] = 'Status';
    $display->display_options['filters']['field_status']['expose']['operator'] = 'field_status_value';
    $display->display_options['filters']['field_status']['expose']['identifier'] = 'field_status';
    $display->display_options['filters']['field_status']['value'] = $options;

    $views['my_view_name']->display['my_view_page'] = $display;
  }
}

--- ALTERNATIVE SOLUTION ---

Since this problem seems to be hard to fix (@ least for my specific case) I have used a workaround to achieve the goal.
The solution consists basically on a Views Block Clone with Exposed Filters which overrides the Views Block (without exposed filters) according to specific cases (Is User LoggedIn, Content Type, Contextual Filters ecc..).


texts: switching display suite view modes based on context or user location, show/hide fields based on user location

texts:
The Drupal 7 site i'm working with needs to have a services directory, each service needs to have a general description and a description for health professionals.

So I've created a new content type and called it service, and create 2 custom fields one for general description and one for the health description.

Now the the general services will create their own menu items (this part is fine), the healthcare ones will need to be available in a sortable list as pictured below

http://i.imgur.com/gPf19.png

Now here's the tricky part.

(I know I could just create 2 content types, one of general and one for healthcare but i'd like to reduce the double handling and maintenance as much as possible - so if there is
a way to have all the data entered in one content type that would be ideal)

Using display suite I can hide one of the fields, and using views I can create the directory listings but the directory listings created by views all just link back to the node.

So far I haven't been able to figure out a way to manipulate which fields are displayed (or even switch between display suite views) based on where the user is in the site.
This could be context, a link, or block on a page, i'm open to anything at this point.

Hopefully this is starting to make sense:

Services Content Type (takes all the data, field 1& field 2)

Viewing Content through general services (/services/service-name/service-item)

Display field 1

Viewing Content through health care (/services/health-care-professionals/service-item)

Hide Field 1

Display Field 2

I was hoping you could give me some pointers, I've looked into using the context module, rules module, even had a thought about having 2 content types and using rules to copy the data from

Content Type 1 Field 2, to Content Type 2 Field 2 upon saving..


texts: Search a content type based on certain criteria

texts:
I am faced with a challenge for my company's new website.  We are using Drupal 7 and here is the situation:  We have approximately 250 doctors in our group and I am tasked with creating a custom search page where users can search our doctors based on certain criteria (e.g. specialty, gender, location, etc.).

I have created a content type of "doctor" and entered all of the physician data that will be needed.  My question is:  how is the best way to go about setting up the search that I want to give my visitors?  I would assume that I need to restrict a search based on content type, but how can I throw the additional search parameters in there?  Are there some modules that give very granular options like I'm looking for, or am I looking at having to create and code a custom module??

I'm a little lost and any direction would be very helpful.


texts: Can't install modules in Drupal 8 Ubuntu - Should I change owner?

texts:
Its not the first time I install Drupal 8 on Ubuntu 15.10 (which I'm very new to) but it is indeed the first time when I can't install modules at it.

I ran the error at Google and After reading this document regarding to a similar problem in Drupal 7, and a few other docs, It seems I should do in terminal:

sudo chown -R www-data sites

Since I am new to Linux and I also know that Drupal 8's folder hierarchy has been changed a bit, and I'm not sure if its the right move (I'm afraid to make mess); Thus, I dedicate this question to senior developers which are also Linux veterans...


texts: Module to convert a decimal amount of US Dollars to an equivalent amount of BitCoin

texts:
I am still new to Drupal and am looking for a module that does the following: convert a decimal amount of US Dollars to an equivalent amount of Bitcoin.

Is there such a module that can handle this or would I have to code this from scratch?

More info:

Accepts a decimal based argument in USD
Submitting the form sends a request to a 3rd party API to convert the dollar amount to BitCoin
Module should create a means to store any API connection details required to communicate with your API key in the database
Module should pull this value from the database when making a request to the API


texts:
My Drupal is 7.59 and since then I have following warning error on my site:

  Warning: ini_set(): A session is active. You cannot change the session
  module's ini settings at this time in drupal_environment_initialize()
  (line 697 of /usr/share/drupal7/includes/bootstrap.inc)

and no login possible since then.

I have tried several configurations inside bootstrap but nothing came out.

Some ideas?


texts: How to use Services Basic Authentication?

texts:
How to use Services Basic Authentication module?

I want to add http basic auth for my service. I have installed it and enabled it on my end point configuration. I got this "HTTP basic authentication Services_basic_auth has no settings available" in my end point configuration. where is the setting page?


texts: Checking if module has the right output on multilingual pages with simpletest_clone

texts:
I'm trying with simpletest_clone to check if my modules have the right output depending on the language.

Now my problem is, that when I do the following Code:

$this->drupalGet('de');
// check the output

$this->drupalGet('fr');
// check the output again for the french version

Drupal then checks for localhost/de/de and localhost/de/fr (de is the default language) instead of localhost/de and localhost/fr

How can I change that behaviour?


texts: How to alter add content form to include a new setting panel?

texts:
Here is the code for creating a new Tab in the settings panel on "Add article" node.
But it is not displaying.. what could be the errors ?

function mltag_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'article_node_form') {
drupal_set_message('Editing a node');
$form['mltag'] = array(
    '#type' => 'fieldset',
    '#title' => t('MLTag settings'),
    '#access' => TRUE,
    '#collapsible' => TRUE,
    '#group' => 'additional_settings',
    //'#attached' => array(
    //        'js' => array(drupal_get_path('module', 'autordf').'/autordf.js'),
    //),
    '#tree' => TRUE,
    '#weight' => -2,
    '#attributes' => array('class' => array('mltag-settings')),
);
$form['mltag']['enabled'] = array(
    '#type' => 'checkbox',
    '#title' => t('Generate tags use Mltag'),
    //'#default_value' => (empty($form['nid']['#value'])),
);
}
}


texts: French accented characters not saving to database

texts:
I have created a module that reads in a csv file that has french accented characters in it to create nodes from. The creation of the nodes seems to work fine but when I execute the node_save() command I get the following error:

An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows.
Path: /batch?id=55&op=do StatusText: Service unavailable (with message)
ResponseText: PDOException: in field_sql_storage_field_storage_write()
(line 494 of /var/www/html/modules/field/modules/field_sql_storage/field_sql_storage.module).

The special character I am having problems with is é character (however I am sure other accented characters will cause me grief as well).

I thought this was an encoding issue and checked the database encoding on the tables - all tables are set to UTF8. I believe that this is the correct encoding and should work (however I am no database expert).

I tried using the following code:

$encodedval = mb_check_encoding($val, 'UTF-8') ? $val : utf8_encode($val);

Which seems to help but still gives the same error after 300 items are read in (there are 3000 items that need to be imported). During the importing, I am Geo-referencing the nodes, so could this be Google killing the look-ups after so many hits?

I am at a loss and would appreciate if anyone could shed some light as to what might be the issue.


texts: How do I avoid duplication in a view result?

texts:
I want to list the states from the state/province field (handled by the Location module) in a content type. I used views, but it shows the same state name more than once.

I enabled distinct in the Views module, but it doesn't works. How can I avoid the same state name is shown more than once?

Current Result: Illinois, Georgia, Alabama, Illinois, Alabama, Alabama, Georgia.

I attached the screen shot of my view (I used table format and views group by module).

Expected Result : Illinois, Georgia, Alabama.

This is my views set up.

This is what I'm getting from my view.

I'm expecting this result no matter how many nodes have the same state; I want to display the state name only once.

This is the table style I used, and views group by module.


texts: contextual filter for a block view with relationship

texts:
I defined two content types : Book, Quote. A quote has a Book field, an entity reference to the book it is extracted from.

I want to build a block view to be displayed on each Book node page : all the quotes extracted from that book. In other words, all the quotes whose Book field value matches the NID of the current Book node.

So I defined

• a relationship field_book : Content (Content using field_property_book) ;

• a contextual filter : (field_book : Content) Content : Book set

to use Relationship = field_book : Content
When the filter value is NOT available :
Provide a default value = Content ID from the URL
(I also tried Raw value from URL + element number 2 : node/NID)

The view block displays no results. Obviously, I missed something about configuring a contextual filter for a block view ! Any ideas ? Help to a newbie with relationship greatly appreciated :-) Thanks.


texts:
I hoped the documentation for theme_field() would tell me how to create a render array that may be parsed by that function.

Based on that, I thought something like this would work.

return array(
    'test' => array(
        '#theme' => 'field',
        '#label_hidden' =>  false,
        '#title_attributes' => 'class="test123"',
        '#label' => 'test',
        '#content_attributes' => 'class="test456"',
        '#items' => array()
    )
);

It prints a &nbsp;.

what am I doing wrong?

The ultimate goal is of course printing some field_items, but I can find no documentation on how the render array for #items should look; nothing I tried outputs anything.

A pointer to better documentation might answer my questions.


texts: How to add IE specific stylesheet in drupal 7 in drupal way

texts:
I want to add this into my Drupal site in a Drupal way!

<!--[if IE]>
<link type="text/css" rel="stylesheet" href="IE.css" media="all" />
<![endif]-->

I know it can be done easily by adding the above tag directly into html.tpl.php but I don't want hack the Drupal core and I want to follow a Drupal way for this.

What would be the best possible solution?


texts: How to change core search result snippet?

texts:
I want to change core search result snippet. I tried with preprocessor theme_preprocess_search_result(&$vars) but in $vars['result']['node'] there coming basic fields values and rendered content array. In my node, content is with paragraph bundles and field collections. I want to display one of my bundle value in search snippet.

$vars['result']['node'] values coming in array key 'rendered'

stdClass Object
(
    [vid] => 1039
    [uid] => 1
    [title] => What are the cut off times for funds transfers to an external bank?
    [log] =>
    [status] => 1
    [comment] => 0
    [promote] => 1
    [sticky] => 0
    [nid] => 235
    [type] => support
    [language] => und
    [created] => 1444988988
    [changed] => 1446531922
    [tnid] => 0
    [translate] => 0
    [revision_timestamp] => 1446531922
    [revision_uid] => 1
    [field_support_type_ref] => Array
        (
            [und] => Array
                (
                    [0] => Array
                        (
                            [tid] => 16
                            [taxonomy_term] => stdClass Object
                                (
                                    [tid] => 16
                                    [vid] => 4
                                    [name] => Internet Banking
                                    [description] =>
                                    [format] => filtered_html
                                    [weight] => 0
                                    [vocabulary_machine_name] => support_type
                                )

                        )

                )

        )

    [field_paragraph] => Array
        (
            [und] => Array
                (
                    [0] => Array
                        (
                            [value] => 1102
                            [revision_id] => 7916
                        )

                )

        )

    [name] => orangedigital
    [picture] => 0
    [data] => b:0;
    [workbench_access] => Array
        (
            [28] => 28
        )

    [entity_view_prepared] => 1
    [rendered] =>
Type:
Internet Banking
Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet.

)


texts: How do I include a class in a link inserted in an entitiy's link area?

texts:
I want to insert a link to a ctools modal popup with a custom style (class) into the link area at the bottom of an entity (e.g. a node).  I do this using hook_entity_view_alter.  This is how the relevant part of my code looks like:

/**
 * Implements hook_entity_view_alter().
 */
function mymodule_entity_view_alter(&$build) {
  // Set up ctools etc. to use modal omitted for brevity.
  $build['links']['popup']['#links']['mylink']['title'] = 'show popup';
  $build['links']['popup']['#links']['mylink']['href'] = 'mymodule/nojs/modals';
  $build['links']['popup']['#links']['mylink']['html'] = TRUE;
 }

The code shown above inserts the following link in the right place:

show popup

However, this leaves out the class required to give the modal a custom style.  This what I really want to have this link look like:

show popup

Question: How do I get class="ctools-use-modal ctools-modal-mymodule-style" included in this link?


texts: How do I preprocess_html() a panelized page?

texts:
My intentions is to take a panelized page and use fields provided in that page to create class names on the body element.

When I preprocess the page, I don't get the original node information and can't pull the information I need.

My panelized page has 1 pane that has the node-> content pane in there.

If I could just get the NID of the current page, then it would be okay. But that doesn't even show up in the variables in the theme_preprocess_html() when a page has been panelized.


texts: Which contributed modules are being moved into Drupal 8 core?

texts: There were a significant number of D6 modules (or versions of) that were pulled into D7 core. I am wondering if there are any for D8?


texts: "Class not found" error when attempting to access inbuilt DateTime class

texts:
I am attempting to convert a working Drupal 6 module to Drupal 8 in preparation for the up coming release, and as an exercise in learning the new system.

In my existing module, I do some calculations on whether or not it is currently the weekend or a weekday and output some HTML in a block based on that.

In my code I have a is_weekend() function which returns TRUE if it is currently the weekend, and FALSE if it is a weekday.

My code for that function starts like this.

function is_weekend() {
  $ESTTZ = new DateTimeZone('America/New_York');
  $dt = new DateTime();
  $dt->setTimezone($ESTTZ);
  $day = $dt->format("w");
  $hour = $dt->format("H");
  $minute = $dt->format("i");
  $weekend = FALSE;

  if ($day == 6) {
    // ...
  }

  return $weekend;
}

It works fine; however, when I try to put this function into my new block class I get the following error:

  Fatal error: Class 'Drupal\livequotes\Plugin\Block\DateTimeZone' not found in C:\Work\ex-global-8

How can I call this PHP class from within my own block class?


texts: Can I change an upload URL to match the original upload?

texts:
I uploaded a PDF in Dupal and used the URL created. Somehow, that document wasn’t saved or was deleted, so now that URL (which is being promoted widely) leads to a page not found. I uploaded a new document, but Drupal renames the URL just slightly.

Can I somehow change this URL to match the original upload or redirect somehow?
I am not sure which version I use (or where to find this).


texts:
I have a taxonomy called sponsors with an image field attached. Then I have a content type with a field-collection and inside of the field collection I have the term reference.  So when the admin creates a content type they can choose a sponsor and I setup a view to show the image.  However, they would like to have 3 different sizes to choose from when creating the content.  Is it possible to provide them with a choice of image styles almost like the Insert module let's you do?

UPDATE:  Looks like it's going to be custom code.  The formatter module is nice, but it does not suite the needs for my particular use case.


texts:
Is there a module that lists which tables are created, owned or modified by a particular module?

I need something that can show me what tables are created or modified by when new modules are installed.


texts: How can i load a table on changing a select option using AHAH callback

texts:
I have drop down in a form as follows and i want to load a table of data using the drop down value , here is i have tried ,

function list_user_form(){
     $form['howmany'] = array(
    '#title' => t('List all the users in a group'),
    '#type' => 'select',
    '#options' => select_usergroup_dropdown_options(),
    '#default_value' => $default,
    '#ahah' => array(
      'path' => 'mailusers/listuserstable',
      'effect' => 'fade',
    ),

  );
   $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Click Me'),
  );
   return $form;
}

function listuserstable(){
//make html for the table and rendering it
}

But unfortunately it gives me 403 error , please help


texts: Must an admin theme be enabled to be used?

texts:
I've created a sub-theme of the admin theme, Seven, in order to override some CSS used to display date combo inputs on a node edit form. The info file lists a new style sheet and the regions that are defined in the original Seven info file.

Everything seems to work fine if I select this sub theme as the Admin without even enabling it. I can easily override the CSS.

However, if I also enable the sub theme, blocks suddenly appear inside the admin theme whenever it's invoked*. I believe this is because the new sub theme has different (default?) settings for active blocks in the block table. (rfay has a solution for this problem here: http://randyfay.com/content/changing-theme-name-or-adding-subtheme-without-losing-block-and-theme-settings)

My question: Is it necessary to enable a theme/sub theme that will only be used as an Admin theme? If so, is there any way to avoid the block problem, or is that just the way it goes?

* Edit: A lot of blocks appear in the new admin theme when it is enabled. Below is a visualization of the blocks table. Before the custom theme is enabled, it does not appear in the block table, so there are no blocks at all. After it is it enabled, the 12 blocks from the main theme ("custom" in the table) are all placed into the content area. Blocks might end up in the Content region because regions in the enabled theme don't exist in the customized seven theme? In any case, it's just a nuisance really, and can be easily fixed using the SQL at the link above. However, if there is no downside in using an admin theme that is not enabled, the block clean up wouldn't be needed.


texts:
I have this View plugin for displaying which panelized node have which layout:

class unionen_custom_panelizer_handler_panelizer_layout extends views_handler_field_entity {
  function render($values) {
    if ($entity = $this->get_value($values)) {
      if (isset($entity->panelizer->display->layout)) {
        $layout = $entity->panelizer->display->layout;
      }
      else {
        $layout = t('No layout found');
      }
      return $layout;
    }
  }
}

The result is correct when displayed in a pane, page or other display, but when I preview it, displays the wrong results - panel layouts that are not used at all for the panelized nodes. It is not a biggie, I just want to understand why I get the wrong results....


texts: What is the difference between "Path redirect" and "Global Redirect"

texts:
I read the description of Global Redirect and Path redirect, but I still don't understand what the difference between the modules is, and why Path redirect recommends Global Redirect.

What is the difference between the modules?


texts: How should a custom module install a reference data dictionary?

texts:
I'm about to write a custom module dealing with chemical hazards symbols. It's basically a 300-item dictionary of simple objects: a symbol, its description (around 100 chars) and in some cases a supplementary short information.

I'm still undecided whether I'd make my module a text filter, field or entity, but regardless (I think) of the way I choose, I'm clueless about what would be the Drupal way to install this simple dictionary, a PHP variable, a persistent variable, or a database table?

My guess would be that storing it as PHP variable would not burden the memory too much, it would provide quick lookup access, and would save database queries. Would there be any benefit to choose the table option?

What is limiting me in using taxonomy here is that some terms would have to be supplemented by a piece of information on a binding/instance level. For example, there would be a symbol (term)  P0123: Store in temperatures below %1 C/ %2 F or P2345: Wash %1 thoroughly after handling. For each node referencing that term there should be a possibility to add the precise values that might be different per node. That is the reason I have been thinking of making it a text filter that would parse line:

P0123,10,50 (<- term with supplementary contextual values, %1 and %2)
P2345,en:hands|de:Hande|es:manos (<- i18n-savvy contextual string)
P3456 (<- term without additional info)

I have already filed a feature request for the Relation module, to provide labelling of relationships on instance level. We'll see if the authors consider it as worth implementing for a wider public. For now I'm trying to find a swift workaround.


texts: How to change the word "blog" for "journal"

texts: I have used string overwrites for a lot of stuff but sometimes I hit a section I cannot change. One of these is the "User's blog" button. How do I change the word "blog" for "journal"? I am impressed no one seems to have asked this question before.


texts: How to conditionally load JavaScript with template.php

texts: I have a content type that has involves some js magic for every node. How can I code it into template.php so that it is loaded only on display of the content type? I don't want the js to load uselessly on every page. My php skills are pretty shallow.


texts: How to translate commerce-order:status in Drupal Commerce?

texts:
I created Rules for receiving e-mail when you change the status of the order.
E-mail send but not translated.
I created a rule in Action Send Email. In the present rule in the message I created a PHP script

PHP
    $status="none";
    if("[commerce-order:status]"=="checkout_shipping") $status="text1 text1 text1 text1";
    else if("[commerce-order:status]"=="checkout_checkout") $status="text2 text2 text2 text1";
    else
   $status="none none"

Given the status of your order: $status

The message that comes is "none none";

I do not know what's going on. I get tired of it already the second day.
Thank you for your help


texts: notice: "Notice: Uninitialized string offset: 0 "

texts:
I have created a module in my project.

Everything works well on my local server. but when I upload my project on internet host I faced this alert message "Notice: Uninitialized string offset: 0 " in all pages. (it seems module works but I don't know why is the cause of this notice message)

This message happened on this line

if(isset($data['content']['whois_lookup_data']['#markup']))

Also, in my local server my PHP version is 5.3 while in internet php version is 5.2

Is this error related to version of PHP ?


texts: How do I delete all menu links from a menu using the menu machine name in Drupal 8

texts:
I trying to get the existing menu items and then delete them in bulk but I'm getting an error trying to load them.

$query = \Drupal::entityQuery('menu_link')
->condition('menu_name', 'mycustommenu')
// Order by weight so as to be helpful for menus that are only one level deep.
->sort('weight');
$result = $query->execute();

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "menu_link" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() (line 125 of core/lib/Drupal/Core/Entity/EntityTypeManager.php).

Can someone suggest how I might do this better thanks.


texts:
I'm using Drupal 7 and workflow module for Article content type.
There are two roles author, editor. There can be as many number of authors as how many we want, but there are only four editors.
Workflow states: Review, Back to Author and Publish.

Worflow offers very good publishing process throught it's rules and actions. Authors create articles, and change the workflow state to Review and save it. Editors have two choices either to publish the content or return it back to the author of the article. Works cool!

But what I want is to make the authors to choose one of the editors(there 4 of them), that editor is going to be assigned to this article, and only he/she can edit this article while the worflow state changes into Review. Currently any user with Editor role can edit the articles with Review state.


texts: Update webform submitted data through the DataBase?

texts:
I see in the DataBase the table webform_submitted_data which contains the components's data of all webforms

But a token suddenly stop working as intended so the hidden fields of the webform, its data were incorrect for my use case. I fixed the issue but now want to update the affected submissions (luckly are only 10)

It is safe to update the respectives rows through a SQL statement? I do not need to trigger hooks, or other stuff, only need the correct data for the little code i write that uses it


texts:
If I want to divide a row into some sub-rows in Drupal 8, what should the code be?

The following code worked fine for simple tables. I need to do something with the $rows array to divide the rows in sub-rows. How can I achieve this?

$form['mytable'] = array(
  '#theme'  => 'table',
  '#header' => $header,
  '#rows'   => $rows,
  '#empty'  => t('Not Found.'),
);


texts:
I have Author Pane installed along with D7 Advanced forum. I am wondering how to shorten the display format of 'Join' and how to remove 'Last seen:' from the pane?
I could not see any guidelines in the module's docs or issues about this.


texts:
I use cash on delivery payment method. When the user select this payment method an extra fee should be added to the order total. NOT to the product line items. Any ideas? I read i a post that a workaround for that is to add a custom line item and charge it the extra fee. Anyway I didn't understand how i should that

I put this code to my custom rule action in order to add a price component via a line item. The problem is it throws an error when i finally save the order in the last line. The error is:

Warning: Invalid argument supplied for foreach() in commerce_price_components_combine() (line 972 of /Users/Sakis/Sites/Under_Construction/e-wireless/profiles/commerce_kickstart/modules/commerce/modules/price/commerce_price.module).

$default_currency_code = commerce_default_currency();
if ($balance = commerce_payment_order_balance($order)) {
   $default_currency_code = $balance['currency_code'];
}
$line_item = commerce_line_item_new('cod_fee', $order->order_id);
dsm($line_item,'line_item');
// Wrap the line item and order to simplify manipulating their field data.
$order_wrapper = entity_metadata_wrapper('commerce_order', $order);

$line_item_wrapper = entity_metadata_wrapper('commerce_line_item', $line_item);
$line_item_wrapper->line_item_label = 'Αντικαταβολή';
$line_item_wrapper->quantity = 1;
$line_item_wrapper->commerce_unit_price->amount = '200';
$line_item_wrapper->commerce_unit_price->currency_code = $default_currency_code;
$line_item_wrapper->commerce_unit_price->data = commerce_price_component_add(
    $line_item_wrapper->commerce_unit_price->value(),
    'cod_fee',
    $line_item_wrapper->commerce_unit_price->value(),
    TRUE,
    FALSE
);
commerce_line_item_save($line_item);
// Add it to the order's line item reference value.
$order_wrapper->commerce_line_items[] = $line_item;

// Save the order.
$order_wrapper->save();


texts: SimpleTest: How to make multiple Ajax posts and then save the data?

texts:
I have a form with AJAX buttons that add items to a list. To SimpleTest the form, I need to make the AJAX post:

$this->drupalPostAJAX(NULL, $edit, array('op' => 'Add Item Button'));

...then POST the resulting $edit object with the Save button.

$this->drupalPost('admin/structure/fms_report/create', $edit, t('Save'));

My question is, how do I get the resulting $edit object after the first AJAX POST happens?


texts:
I've noticed that the autocomplete textfield widget has not been ported to Drupal 7.
I'm looking for a way to provide user with suggestion for already submitted values, but I don't want to create a free-tagging vocabulary, since I don't want a page with all nodes with a particular value.
What can I do? Has this feature been ported to a separate module like Node Reference?
I've tried Autocomplete Deluxe module, but it works only with terms, not with textfields.


texts: Why cache form table gets new entries by anon page views?

texts:
I am seeing new entries in my cache_form table when anonymous user view a page that had a comment form. The page cache is enabled and set to 30 min. Does this mean that cache page is being bypassed? Or does drupal cahe forms for every anonymous user using a hashed key?

Also I should mention that this happening for forms called and renderd in the theme layer (someone's mistake and I'm trying to correct this) .


texts:
So i want to create a website which presents information about topics over multiple pages, i.e. say the content was films, one page would be an overview of the film and there would be a button at the bottom which would pull up the films cast etc (think like a multi step signup form).

My current thinking is I could create this as a series of views so have like one view that links to %film/overview, %film/cast etc. As I am still pretty new to drupal I thought I would ask here whether this was the best way to present this type of content, or if there are better options?

Thanks.


texts:
I'm trying to make responsive the menu generated by the superfish module and using the Omega theme by using this appoach:

Demo (try resizing your browser)

Script on Github

I also found a theme for joomla which include a superfish responsive menu: here

Before wasting time... Is there any other tested solution out there?


texts: How to hide comments below the node, but not close them?

texts:
Аctually I want to list comments for nodes myself (by Views, for example), so I need to hide standard comments list from core comment module.
I can do it like that:

  unset($node['comments']['comments']);

But it will not prevent DB query for comments.
So I found some crazy ways to trick the comments module. For example, to set fake $node->preview property, or to create new view mode and overwrite standard node/%node callback.

Is it really so difficult to hide comments below the node but still allow to add new comment, or I missed something?

Update about “Hidden” option

What about “Hidden” value for the content type:
I need close/open behaviour for my comments. But if I set “Hidden” for my content type, my new content pieces are set to “Comments closed” instead of hidden (here is the code).
Another problem is that user with permission to “post comments” can't add a comment, if comments are hidden (here is the code).
So I can't get the idea.

Answer

Solution found with hook_module_implements_alter(). Thanks a lot!


texts:
In my content I have one date field label, it is showing all uppercase letters automatically.

Example :I have given date field label as birthday(lower case) but it's automatically showing BIRTHDAY(UPPERCASE). How can I overcome this.


texts: Deleting field collection bundle programmatically from core

texts:
I have a field collection bundle that I want to remove from my site. I was googling how to do that and  came upon these instructions, but they seem to be from the ECK module, and only apply to entities created by eck. The company I work for has a module review process and this module doesn't have a stable release yet.

So, ideally there would be a way for me to do this from core, or at least the field collection module, without extra modules. Is there?

Edit "No, you can't" is a perfectly acceptable answer. If that's the case I would like to stop chasing down blind alleys.


texts: Get value for a field from url while saving a new node

texts:
How to find a next Entity ID/Node ID?

Here is my scenario. I created my own Content Type which has 10 fields, one of these 10 fields has to save to DB thru a custom module. Value to this field is being passed thru URL filter.

Really appreciate any help.


texts: Commerce Kickstart product sub-categories

texts:
When you set up product category taxonomy items, it seems that subcategories are not supported. If your product is in a subcategory, it doesn't show up when you choose the main category from the main menu on the front page.

i.e., lets say I added a category of 'Computers' and Subcategories of Desktops, Laptops, Games, and Accessories. How do you display those subcategories?

Would it be better to just use the commerce module, or are these systems simply not powerful enough to manage product category depth greater than one level? So in this case, the whole product category menu would be filled with 100 different categories... It just doesn't seem like a realistic approach.

There are always subcategories, unless you sell items as simple as t-shirts, shoes, and gadgets. You could never have :

'Footware' and then subcategories of sneakers, casual, sandals, and dress shoes, etc, etc.

Tops and subcategories of t-shirts, long sleeved shirts, sweatshirts...etc..

I think you get the idea. This drupal 'starter project' isn't a pro solution, is it?

So, can I extend it to show, organize, and sell those subcategories?

[EDIT!]

Wait! I think I figured it out - you can impose hierarchical structure through the Collection product category taxonomy!

I will play for a bit and update with results. Things are looking a bit brighter...

So, I just didn't understand how things were organized.

Collection is the parent Category
Category is the sub category - or whatever single level taxonomy you choose

These must be fields in your Content Type
Then the 'variable' portion (like color) goes in the Product Variation for that selection of the Collection & Category

Seems to work


texts: How to send a webform email to all users of a specific role?

texts:
Is it possible send webform data in email to all users of a specific role?

In the webform email settings there is no such option.

I also tried with Rules, but in rules the webform tokens are rendering the webform submitted data.

Here is my rule attached.

{ "rules_send_email_to_ce_user_on_webform_submit" : {
    "LABEL" : "Send email to CE user on webform submit",
    "PLUGIN" : "reaction rule",
    "ACTIVE" : false,
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "webform_rules" ],
    "ON" : { "webform_rules_submit" : [] },
    "IF" : [
      { "webform_has_id" : {
          "form_id" : "[form-id:value]",
          "selected_webform" : { "value" : { "webform-client-form-121" : "webform-client-form-121" } }
        }
      }
    ],
    "DO" : [
      { "webform_submissions_load" : {
          "USING" : { "nid" : "121", "sid" : [ "data:sid" ] },
          "PROVIDE" : { "submissions" : { "submissions" : "Fetched submissions" } }
        }
      },
      { "mail_to_users_of_role" : {
          "roles" : { "value" : { "11" : "11" } },
          "subject" : "Form submission from: [node:title]",
          "message" : "DATA\r\n[data:data]\r\n\r\nRAW\r\n[data:data-raw]\r\n\r\nField value\r\n[data:title-value]"
        }
      }
    ]
  }
}

Any other method?


texts: Rules: How to check one field against same field on all other nodes of that contenttype?

texts:
Using Rules I would like to check the values of some fields.

I have a content type 'A' which has a custom field called 'address'. All nodes of content type 'A' are imported through Feeds.

I would like to create a rule where each node that is imported is checked, to verify if the value of field 'address' is equal to the value of field 'address' on any of my other nodes of type A.

I have read about 'Entity has field' as a Rules Condition. However I understand that this only checks several fields in the same node, while I want to check one field against all other nodes.

How can I accomplish this with Rules or any other method?


texts: Get value of programmatically (form_alter) added fields at form submit

texts:
I'm altering a node creation form using the form_alter hook in a custom module. In this particular case, I'm adding an email field which is not part of the content type structure. At the node creation, I need to send an email to the address entered in the field.
Using the hook entity_presave or entity_insert I have access to the entity field that are part of its structure, but not to the programmatically added email field. How can I get that value at the form submit?


texts: Render content type display mode in custom module

texts:
I'm facing the issue with rendering content type in specified display mode (teaser) in my custom module. I have a module which stores NIDs in session, and when user enters specific page, I want to load those NIDs from session, then get specified node's fields from Drupal DB according to these NIDs and print content types on page in my module in template.

Is this possible, or am I aiming the wrong way?


texts: How can i find out which form mode is used from hook_form_FORM_ID_alter?

texts:
I have created a new form mode (in the UI at admin/structure/display-modes) for a custom entity (form mode is entitled apply) and added apply to the form handler classes in the entity class.

The form is built and returned in a Controller, and specifies the form mode.

$form = $this->entityFormBuilder()->getForm($entity, 'apply');

Now I would like to be able to determine from a hook_form_alter whether this form is being displayed using the apply form mode, but I cannot work out how that is available from $form or $form_state.


texts: Difference between browser session and Drupal session

texts:
After reading this question over here from 2014, I'm left wondering:

Is there any benefit, security concern, or real reason to use Drupal's session manager class over the browser session $_SESSION[key]?

Specifically wondering about the Symfony session API that was mentioned in the above linked question and whether or not that provides any benefits over the way i'm storing and accessing session data.

'The Drupal Way':

$tempstore = \Drupal::service('user.private_tempstore')->get('mymodule_name');
$tempstore->set('my_variable_name', $some_data);

How I'm currently doing it:

$_SESSION['three_minute'] = array();
$_SESSION['three_minute']['utility'] = $form_state->getValue('utility');


texts:
I have installed and enabled the panelizer module and enabled the node_view template system page on the Page Manager administer pages page. I enabled panelizer for the Basic Page content type and created a new page. I clicked the panelizer tab and used the builder layout to create a new row below my body content. I added a region to the row and used the menu to add an existing node to that region.

It looked fine it preview so I saved it and went checked out the actual page where I saw the node content but not any of the panelizer content. The content in my added rows and regions did not display.

I tried uninstalling panelizer and re-installing but it still isn't working. Did I forget something?


texts:
I am new in drupal.. please let me know what is the meaning of

$styles

in drupal html.tpl.php file..
If we want to add new css and js from where we can add this..

PLeas help me..


texts:
I would like to add some custom images into the header block of my website and the problem is that I don't know if I should modify some php file or if it is possible via admin panel. Which method is better and if it is better to modify a file, which file is it and where is it located.

Thank you in advance.


texts: I'm using D7, and I've created the Content Type 'Poll'. That said, I want to add a specific Poll I've created to a published Blog Entry. Is this possible? I thought about creating a poll block, but this would just publish the same poll on all of my Blog Entries? I also can't seem to add a specific Poll field to my Content Type 'Blog'...


texts: Is there a way to export all roles and permissions from testing environment to be imported/deployed on production environment?

texts: I have testing and production environments that host drupal-7. I have some roles and permissions settled on the testing environment. Can I export these roles and permissions to the production environment to avoid double effort?


texts: Modifying search terms in Drupal 7 Search API

texts:
My end goal is to wrap each keyword in * essentially enabling wildcard searches (partial word search). For instance, if I type "word" into the search box I get 99 results, if I type "wor" into the search box I get 0 results, if I type "*wor*" into the search box I get 99 results. I would like to always wrap search terms in *. Below, I can successfully assign the new keys, but the search results are still not correct. When I search "wor" I still get the same results, where I would be expecting the results of "wor".

mymodule_search_api_query_alter(SearchApiQueryInterface $query) {
  $index = $query->getIndex();
  $keys = $query->getKeys();
  $wildKeys = array();
  //wrap each original keyword in *
  foreach($keys as $key => $value) {
      if(is_numeric($key)) {
          $wildKeys[$key] = "*" . $value . "*";
      }
  }
  //sets the keywords to search on to our new keywords which are wrapped in *
  $query->keys($wildKeys);
  $query->preExecute();
  $query->execute(); // Do We need this? $query->getKeys() is now correct, but search results are not as expected
  //krumo($query->getKeys());
}

My coworker found that his $keys were a string, vs my seeing that they were an array. I added a check for this and this code is working.

function mymodule_search_api_query_alter(SearchApiQueryInterface $query) {
  $index = $query->getIndex();
  $keys = $query->getKeys();
  if(is_array($query->getKeys())){
    $keys = $query->getKeys();
  }else{
    $keys = explode(" ", $query->getKeys());
  }
  $wildKeys = array();
  //wrap each original keyword in *
  foreach($keys as $key => $value) {
      if(is_numeric($key)) {
          $wildKeys[$key] = "*" . $value . "*";
      }
  }
  $wildKeys = implode(" ", $wildKeys);
  //sets the keywords to search on to our new keywords which are wrapped in *
  $query->keys($wildKeys);
  $query->preExecute();
  $query->execute();
}


texts:
Here is my scenario - I have populated my content in a panel which consists of 3 views. Each view has a set of documents.
At the bottom of the page (panel page), I want to add a link which when clicked will take me to another view page populated with all documents from the caller node.  I'm very new to drupal and not able to figure out how to do it.

Please put in your suggestions on how I can do this.
Thank you


texts:
I found a couple of issues with the Drupal 8 integration of watchdog support for views and don't know where to report them. The views watchdog project page only shows issues for the 7.x version.

With an exposed filter for the message field, you can't get results for words within an em tag (like a module name). In some cases, even plain text can't be searched for. Example: message is "Starting execution of backup_migrate_cron()." I can search for messages with "execution" but no for "backup_migrate_cron()" or "backup".

VBO is not supported for this view type.


texts: How do I convert a Drush make commit-level dependency into Composer?

texts:
I am remaking old project to use composer for building and I have a problem I cannot find solution to. Basically this is how library is defined in profile.make file:

; HybridAuth
libraries[hybridauth][directory_name] = 'hybridauth'
libraries[hybridauth][type] = 'library'
libraries[hybridauth][download][type] = 'git'
libraries[hybridauth][download][url] = 'https://github.com/hybridauth/hybridauth.git'
libraries[hybridauth][download][revision] = 'd4e5bc34008e8c187c302eb4e94200ee4a208c63'

How should I rewrite it correctly in my composer.json file? To be precise, how to get revision? This is what I have so far:

{
      "type": "package",
      "package": {
        "name": "library/hybridauth",
        "version": "d4e5bc34008e8c187c302eb4e94200ee4a208c63",
        "type": "drupal-library",
        "dist": {
          "url": "https://github.com/hybridauth/hybridauth.git",
          "type": "git"
        }
      }
    },

it is complaining about my "version" line:

  [Composer\Repository\InvalidRepositoryException]
  A repository of type "package" contains an invalid package definition: Inva
  lid package information:
  version : invalid value (d4e5bc34008e8c187c302eb4e94200ee4a208c63): Invalid
   version string "d4e5bc34008e8c187c302eb4e94200ee4a208c63"
  Invalid package definition:
  {"name":"library\/hybridauth","version":"d4e5bc34008e8c187c302eb4e94200ee4a
  208c63","type":"drupal-library","dist":{"url":"https:\/\/github.com\/hybrid
  auth\/hybridauth.git","type":"git"}}


texts: array_flip() error while creating a menu item with form

texts:
My aim is to create a new menu item and display the user profile form on that page.

Here is the code I am using.

/**
 * Implements hook_menu().
 *
 */
function profile_preferences_menu(){
    $items['user/%/edit/profile-preferences'] = array(
        'title' => t('Profile Preferences'),
        'page callback' => '_profile_preference_display_preference',
        'page arguments' => array(1),
        'access arguments' => array('access profile preferences'),
        'type' => MENU_LOCAL_TASK,
        'weight' => '0'
    );
    return $items;
}

/**
 * Implementation of hook_permission().
 */
function profile_preferences_permission() {
    return array(
        'access profile preferences' =>  array(
            'title' => t('Access List of profile preferences'),
            'description' => t('Access permission to view all the profile preferences.')
        ),
    );
}

/**
 * Function to fetch and display preferences form.
 */
function _profile_preference_display_preference() {
    global $user;
    module_load_include('inc', 'user', 'user.pages');
    $form = drupal_get_form('user_profile_form', $user, 'account');
    unset($form['account']);
    return $form;
}

When I access it using the administrator account, it works perfectly; when I access using another user account (who has the required permission) it gives me the following error.

I wonder if there is any issue with the implementation of hook_menu().


texts: How can I filter content with a date that is somewhere this week by using Views?

texts:
I am developing a project in Drupal 7, in this every content have date field by using the Date module.

I am trying to create a block by using the Views module in which I want to display content with its date field containing a date that is 'this week'.

How can I do this?


texts:
I was running with Drupal 6.22 and tried doing an upgrade to drupal 7.10.
The upgrade reported everything was successful.

My problem is that I was previously using a theme called 'contrast'.
I thought that I had disabled it, but it now has references to that theme.

How can I get around these errors?

I tried moving garland into the all/themes folder and renaming it to contrast, but that only created another set of errors.

Notice: Undefined variable: site_name_and_slogan in include() (line 14 of   /mysite/sites/all/themes/contrast/page.tpl.php).
Notice: Undefined variable: site_name_and_slogan in include() (line 14 of /mysite/sites/all/themes/contrast/page.tpl.php).


texts:
I 'm getting crazy trying to show a value of a custom field (now in core) in a sidebar block. I have tried to show it with the render function, calling directly the field, with no luck.

I have a custom content type named "content1" and a  custom field named "field_test1"; I want that value to be shown on a block that will be visible while viewing the page node.

Do you have any suggestion on how to do it?


texts: Is there a way to know the node being viewed?

texts:
I have a context where I'm placing a block onto a wiki page. Is there anyway for the block to know the node id of the wiki page?

I'd like to write some code in the block's views-view--block--field.tpl.php template file to display something only to the wiki page's owner. With the block being placed on the wiki's page via context, the block needs what node(wiki) page it is displaying and who the node's owner is.


texts: Views block doesn't appear on page if only media-type content is selected

texts:
I've created a view block that has a contextual filter with a Content ID from URL. The view is only to appear on my content types if the field_aside_content has any data in it.
This field is just a paragraph reference type to a selected number of custom paragraphs that are to appear in the aside region of my page.

My problem is if I only select a media paragraph type in this content, the block doesn't display on the page. If I then select a paragraph type that is text-based, then the block displays both the media and text content. If I remove the image, the text shows fine on its own.

What I've noticed is that the only time this block doesn't seem to show up on the page is when I select a media-type of paragraph.
My image, video, map and slider paragraph types won't show up on their own unless they're accompanied by some sort of text-based paragraph type or if a menu or some other block is already in the aside that this block shows up in.

It's weird too because if I check the preview of the page when I'm editing the view, it shows the media content showing up, it just doesn't seem to actually show on the published page.

Does anyone have any idea as to what is happening here?

I've also attached a screenshot of my view settings below to show what I've done in case something needs to be tweaked here:

EDIT:

My page.html.twig file has the following code for the aside:

{% set has_aside = page.sidebar|render|striptags|trim %}
  {% if has_aside %}
  {% block sidebar %}
    <div{{ aside_attributes.addClass(aside_classes).setAttribute('id', aside_id) }}>
      {{ page.sidebar }}
    </div>
  {% endblock %}
  {% endif %}

I've noticed that if I remove the |trim filter, then the images will show up but the issue that then occurs is that even if my aside doesn't have any content in it, it will still show up on a page that doesn't need it.


texts: Two Views with autocomplete filters display no result

texts:
I have 2 views-blocks with autocomplete filters, both filters are for the title field. And autocomplete filters display no result when the views are placed on the same page.
How to make them to not conflict with each other?

I use this module Views Autocomplete Filters


texts: How to set target="_blank" for links in CKEditor

texts:
I use CKEditor in Drupal 8.
I want that every link will open in a new tab of browser. I want that the code look like this

    my link

But if I use the link Button in editor I do not have choice for target blank. I only can fill in the url of link and the code looks like this

    my link

Any idea what I have to do for changing this?


texts: How can I add a class to link around image field

texts:
I have a field field_sidebar_gallery which outputs multiple images. These images are rendered using image style gallery_thumb and the display format on them is using the lightbox2 module which wraps the rendered image in an  tag.

What I need to do is add a class to the  tag which wraps around the image. I could easily do this in the template file for field--field-sidebar_gallery.tpl.php and just look at the uri for the image and build the link and image html myself using the relevant functions (theme(), l() etc). However, taking this approach I then lose all of the configuration abilities of lightbox2 (and I suppose any other modules which may end up manipulating the links in the future)

The output currently is as follows

I've looked at

theme_links()
template_preprocess_field()
hook_entity_view()
hook_entity_view_alter()
hook_node_view_alter()

With little to no success. I suspect the display formatter kicks in and that's what I should be looking at but I don't really know where to start.

All I need to do is for this particular field (field_sidebar_gallery), is to add a class to the  so that the final output is as follows (note the class="thumbnail[...] compared to the above)

If anyone can point me in the right direction, that'd be much appreciated.


texts: I am trying to have three forms available to the public on my site and would love to have them configured in in the vertical tabs layout. Initially I was going to have them available through node/add/form but I have since decided I would rather have them in a panel page to lose that path of node/add. Now that I have the forms in the panel page they no longer have the vertical tab/fieldset layout. How would I go about putting the forms back in that tabbed layout while staying in a panel page?


texts: What are recommended filters for using Pagespeed along with Drupal 7 (and Advagg enabled)?

texts:
We are planning to integrate Google Pagespeed module in our Drupal 7 site which is already using Advanced for CSS/JS Aggregation (Advagg).

Based on the inputs at https://www.drupal.org/node/2182289#comment-8421621 , it seems that Pagespeed CSS/JS filters are not needed since the same job is done by Advagg. Pagespeed has other useful filters for image optimization and inlining critical css.

My question: If someone is using Pagespeed along with Drupal and Advagg, can you share the Pagespeed filters that you are currently using or would recommend? If you are using Pagespeed with Drupal but without Advagg, please share your filter recommendations.

I have been searching extensively on this topic but couldn't find much practical information on using Pagespeed along with Drupal.


texts: Drupal patch files - Why do Drupal patches have complicated file names?

texts:
I know almost nothing on Drupal patches but it is important for me to ask this for others and myself: Why almost every Drupal patch I've seen in discussions in Drupal.org has a long complicated file name? For example, I've seen this one yesterday:

  [Add_rtl_support]-[2635832]-[1].patch

Why is the []-[]-[] structure, why 3 words in the first structure(?), what is the medium-number, and what is the 1 (first patch release from the same committer)?

Two more examples, which are different from the above and one from another:

  metatag_by_path_consequences_fix-2184979-12.patch
  metatag-n2564483-190.interdiff.txt

And there could be more I guess...

I would thank any experienced dev who could shed some light in this context...

And also a subtle question: If I download a file with a long name and than changed the name to something like "fix1.patch" just for navigation comfortability, Will it still work as normal as it should have been?


texts: how to define template_preprocess for custom entity type in module?

texts:
i have a custom entity type defined in a module. I have extended Model entity project to create new entity type. My entity is themed with a key: myentity. Somehow template_preprocess_myentity() not working. Whats the right way to do this?

When I have tried:

hook_preprocess_myentity(&$variables){
  dpm($variables);
}

i could see in theme registry that theme template funtion 'myentity' has hook_preprocess_myentity listed inside the 'preprocess functions' array. Only problem is that its not being processed. And i did flush the cache.


texts: How can I save and exit from the middle of editing an already completed multipage webform submission?

texts:
I've got a multipage webform I'm letting users edit after they submit. There are many pages, and I don't want to force the user to go all the way to the last page to save. Is there a way to submit/save the form either with a Save Draft button, or when they use the prev/next buttons? Or is there a way to programmatically save the edited form ? That would also work.
This question is about editing a completed submission, not creating a new submission.
I've tried adding the submit button to every page, but it seems to function like a next button. If I set rebuild to false, the I can exit the edit process where I want, but the changes are not saved.
I've also tried manually adding a save draft button copied from the webform submission form, but that also did not work, failing the way the submit button did.


texts: Getting the id of all the elements in a form with errors

texts:
I am using drupal 6.
All I want is to find the id of each element that has error in form_get_errors.
I am using preprocess to theme the form error section and tried using $vars['form'] with no luck so far.
how can i do that?


texts: Migrate module: (image) sourceMigration gets correct output, but only loads 1 image

texts:
On the migrate module, my source migration "ProductImageMigration" gets all the files from the database and loads them correctly into my public folder. Checked and double checked, not a single error.

I have a field "field_product_main_images" that includes an unlimited amount of images.

"field_product_main_images" settings:

type: 'image'
allowed-extensions: png, gif, jpg, jpeg
alt & title field enabled
Unlimited amount of values
public files

My "ProductMigration" has following code for my main images:

$query->addExpression("CONCAT_WS(',', GROUP_CONCAT(DISTINCT ct_f.field_foto1_fid), GROUP_CONCAT(DISTINCT gai.fid))", 'main_images');

$this->addFieldMapping('field_product_main_images', 'main_images')
  ->separator(',')
  ->sourceMigration('ProductImages');

$this->addFieldMapping('field_product_main_images:file_class')
  ->defaultValue('MigrateFileFid');

$this->addFieldMapping('field_product_main_images:preserve_files')
  ->defaultValue(TRUE);

When I do an output of my row's main_images I get:

drush_print_r('For product ' . $row->title . ' following images:');
drush_print_r($row->main_images);

// OUTPUT
For product Trampolines walljumping following images:
5248,5249,5250

Which I lookup in my mapping table and finds all possible images. The strange thing is that only one is added to my products, which is good, but I really need all of them...

UPDATE

If I dig deeper, I come across the (possible) strange behaviour that my node id's are getting flushed on the prepare statement of the node.

I'm not doing anything in my custom migration's prepare statement, so that isn't altering anything. This is what I put in my import function of the node.inc file:

public function import(stdClass $node, stdClass $row) {
  ...
  drush_print_r('Prepare node - BEFORE');
  drush_print_r($node->field_product_main_images);

  // Invoke migration prepare handlers
  $this->prepare($node, $row);

  drush_print_r('Prepare node - After');
  drush_print_r($node->field_product_main_images);
  ...
}

I get following output in my console:

Prepare node - BEFORE
Array
(
  [0] => 29226
  [1] => 28598
  [2] => 28599
  [arguments] => Array
    (
        [alt] => Trampolines walljumping
        [file_class] => MigrateFileFid
        [language] => nl
        [preserve_files] => 1
        [title] => Trampolines walljumping
    )
)

And then:

Prepare node - After
Array
(
  [und] => Array
    (
        [0] => Array
            (
                [fid] => 29226
                [alt] => Trampolines walljumping
                [title] => Trampolines walljumping
            )

    )
)

So the prepare statement loses 2 of my images... Why?


texts:
I created a new content type using Drupal 8 with the machine name "reviews." I thought that by duplicating the original content type template file, node.html.twig, and renaming it node--reviews.html.twig, I would be able to override the original template.
However, any new change is not reflected when I open any of my review pages. I have already cleared the cache.

What is the correct way to override the default template file?


texts:
I need to load a full menu for navigation in a custom theme with active trail, and can't find any way to do it, but that can't be right.  I can't imagine such an obvious and widespread use-case having no core support, but I've scoured menu.inc and found nothing.  The functions offered range from inadequate (no active trail) to completely unusable (menu is missing children for the CSS dropdowns/submenus outside the active trail, and even empty when needed most, such as on broken links).

I've tried using the following functions in my THEME_preprocess_page hook:

menu_tree (only renders siblings of the active trail--the navbar can even end up empty)
menu_tree_page_data (same result)
menu_tree_all_data (contrary to the documentation--luckily--this method does not return hidden items, but there's no active trail)

So far as I can tell, my only options are to copy and rewrite several functions from menu.inc, or to load two separate menus and apply deep analysis/merging to find and duplicate the active trail from the incomplete menu into the complete one--and this is just as bad because the data structures don't match.  Is there no other way to get a full menu with active trail?

Also, what if I do go with the latter option using menu_tree_all_data?  Will I end up exposing links that aren't properly going through access checks, or have similar issues?  How the heck does Drupal itself load a full menu, like the Navigation menu which doesn't go away while visiting other parts of the site?

I did find another nearly identical question but no one answered it and that was 9 months ago.  This is for a project that's already running well behind schedule due pretty much exclusively to unforseen Drupal-related issues, so any pointers are much appreciated.

EDIT: Whoops...tried to be thorough and missed a major detail :P  I'm on Drupal 7.


texts:
I have a client who has a portfolio type site which requires a custom content type and the requirement to attach multiple images to each record.

Imagefield allows a fixed number of images, but I am curious if there are better solutions for implementing a photo gallery?

I suppose I could add another content type called "gallery" and associate it to "portfolio" but this seems excessive and way to much work for my client to add/remove images to a potfolio...ideas???


texts: How can I hide a certain warning message showing to users?

texts:
I would like to hide the following warning message from users when they submit a web form. I know when this warning message shows up and don't really need to fix it but just want to hide it from users.

warning: trim() expects parameter 1 to be string, array given in /public_html/sites/all/modules/phpmailer/includes/phpmailer.drupal.inc on line 33.

I tried Disable message module but it's only for the Drupal system error message.
Is there anyway to hide a certain warning message just like above?


texts: Open Id Connect SSO on cross platform sites

texts:
I have 3 sites(all were sub domain sites)

Server(id.test.com) - .NET
Client1(client1.test.com) - Drupal
Client2(client2.test.com) - .NET

Am using OpenId Connect for login. My login & logout using drupal site is successful. But when i login through Client2 and navigates to Client1 site automatic login was not made, when i initiates a click in "Login using Generic" button, login occurs.

Is that possible to login automatically? I have checked OpenId Connect SSO module which supports only for Drupal sites. Is there is any other way to achieve this?


texts:
I have an question about drupal's redirect.

Well I implemented hook_menu for the path: "node/%node/boost".

And I set all callbacks from default node path: "node/%node".

/**
 * Implements hook_menu().
 */
function my_module_menu() {
  $items['node/%node/boost'] = array(
    'title callback' => 'node_page_title',
    'title arguments' => array(1),
    'page callback' => 'node_page_view',
    'page arguments' => array(1),
    'access callback' => 'node_access',
    'access arguments' => array('view', 1),
  );

  return $items;
}

So I would get the node from my custom URL

but I got the redirect to default node URL like "node/123".

Any idea how can I load nodes from the my custom URL?

Thanks

UPD

If I change "page callback" function to the my custom function "my_module_page_view", for example:

/**
 * Callback.
 */
function my_module_page_view($node) {
  return 'Hello Drupal!';
}

I will see the text "Hello Drupal!" on the page with URL "/node/1/boost".

But if I use the next code:

/**
 * Callback.
 */
function my_module_page_view($node) {
  return node_view($node);
}

I will get redirect from "/node/1/boost" to "/node/1"


texts: Entity Metadata Wrapper: Setting User Reference

texts:
Problem

How do I set a user reference value from the reference module using an entity metadata wrapper?

So Far

I have a form submit. It's creating an node with a user reference field. I can't work out what structure will submit the value.

First I tried submitting a user account (object), however this throws an awful error.

global $user;
$ewrapper->field_user_permission->set($user);

I then tried submitting uid, however it said it was expecting an array not a string.

$ewrapper->field_user_permission->set($user->uid);

I then tried creating a custom array based on printing out the array of a field that was already set.

$user_perm = array (
  'uid'    => $account->uid,
  'access' => TRUE,
);

 $ewrapper->field_user_permission->set($user_perm);

But that printed out another horrible error. What should I be using to submit the user reference?

 PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: 'uid' for column 'delta' at row 1: INSERT INTO {field_data_field_user_permission} (entity_type, entity_id, revision_id, bundle, delta, language, field_user_permission_uid) 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, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12, :db_insert_placeholder_13); Array ( [:db_insert_placeholder_0] => node [:db_insert_placeholder_1] => 246 [:db_insert_placeholder_2] => 246      [:db_insert_placeholder_3] => contact_details [:db_insert_placeholder_4] => uid [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => 182 [:db_insert_placeholder_7] => node [:db_insert_placeholder_8] => 246 [:db_insert_placeholder_9] => 246 [:db_insert_placeholder_10] => contact_details [:db_insert_placeholder_11] => access [:db_insert_placeholder_12] => und [:db_insert_placeholder_13] => 1 ) in field_sql_storage_field_storage_write() (line 451 of C:\XAMPP\htdocs\drupal\modules\field\modules\field_sql_storage\field_sql_storage.module).

EDIT

New error for creating a new level:

$user_perm[] = array (
  'uid'    => $account->uid,
  'access' => TRUE,
);

$ewrapper->field_user_permission->set($user_perm);

PDOException: SQLSTATE[21S01]: Insert value list does not match column list: 1136 Column count doesn't match value count at row 1: INSERT INTO {field_data_field_user_permission} (entity_type, entity_id, revision_id, bundle, delta, language, field_user_permission_uid) 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_uid, :db_insert_placeholder_6_access); Array ( [:db_insert_placeholder_0] => node [:db_insert_placeholder_1] => 253 [:db_insert_placeholder_2] => 253 [:db_insert_placeholder_3] => contact_details [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6_uid] => 190 [:db_insert_placeholder_6_access] => 1 ) in field_sql_storage_field_storage_write() (line 451 of C:\XAMPP\htdocs\drupal\modules\field\modules\field_sql_storage\field_sql_storage.module).


texts: Why drush sql-sync fails with mysqldump unknown variable error?

texts:
I am having issues trying to sync my staging server with my local server using drush sql-sync command.

I've set my aliases right and the same configuration is working with my development server and local machine.

Here are the issues I get once I type in:

drush sql-sync @stag @local

I get the standard warning about backing up my target database.

Then I'm having this error:

stdin: is not a tty
mysqldump: unknown variable 'table_cache=67108864'
Database dump failed

So I am pretty sure this has something to do with MySQL configuration on the staging server.

From what I've googled/read, a large value for the table_cache is not necessarily a good one for the server and can slow it down. But I am not sure what a "good" value is.


texts: How can I set a flag to be flagged unlimited number of times?

texts:
I have a flag on a node that anyone can flag. The flag is tied to a Rule that executes an action. Essentially I need to be able to allow any user to flag a node as many times as they wish and track the flag count.

The problem: It appears that with the Flag module, the flag needs to be unflagged for the user to be able to flag it again. This essentially makes the flag count pointless as they are adding, removing and re-adding the same flag over and over.


texts: Simplenews adds newsletters title at the top of the newsletter

texts:
I have a Drupal-7 site and a testing one and a weird thing happens. When I send a newsletter from my testing site everything is ok, but when I send from the actual site, the title of the newsletter is added at the top of the newsletter. So the newsletter appears like this:
Title
Title
images , which is what I want to only appear.

Another weird thing that happens, is that the title appears only at some emails like outlook, but not on gmail or hotmail.

My question is, why do you think that this happens?Do I have to check my administrator options, or is this a code issue, like at simplenews.module file?
Thank you in advance!


texts: How to access a field of a referenced entity in a computed field?

texts:
I would like to access a field of a referenced entity in a computed field.

For example: The content type A contains an entity reference field referencing the content type B; B has a "price" field. A has a computed field as well. In this field I would like to load the value of the "price" field from the referenced node.

How can I achieve this?


texts:
I am formatting the user profile page in Drupal 8.9.2.
Are tokens available for the user being viewed (in user profile page), to display the user information?
I am using the Token and the Token Filter modules for this.
(edited: 8:44 AM 10 Sep 20)


texts:
I am confused about using and setting up ssl on website.
On my site I would like to serve some pages using https protocol. From my understanding of what I read, I need to set up

ssl certificate - so site can be accessed from http and https
use module like secure pages to redirect users to https on certain pages.

Is this the correct way of what I want to achieve? Moreover, my concern is about duplicate content - what is the solution for restricting https to be crawled? I hope someone can put somelight on this. Thank you.


texts: How to add a class to more link of a view?

texts: I want to add a class to a views more link available under pager section using template_preprocess_views_view().


texts: How to get the values from a formatted field in inc file

texts:
I have a description field with a CK editor enabled. And when I get the data from it as node->get('fieldname')->getString() it outputs the content as below.

The contents that I have entered in the Ck editor
, basic_html

I can resolve this in the twig file by getting this as {{fieldname| raw}}. But I need to get this in a php file. How do I get the value without that , basic html part?


texts: Date field with selection back more than 20 years

texts:
I have a date field:

the year selection is possible 20 years back from now:

But I need it to be 25 years. Is this a fix Drupal setting or can I change that?


texts: Programmatically printing from field_collection array

texts:
Is there any simple way to print a certain number of elements from a field collection?

Say I have an array of 8 elements and want to just print 4 at the top of a page; then, print the other 4 at the bottom.
Right now I'm attempting it in the node.tpl I am theming.

print render($content['field_my_elements_of_whatever']);


texts:
I am using Views to create a content view page. Whenever I try to add the VBO pull-down menu with the Delete all checked option, Views gives me a popup window with the following error:

  An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging
  information follows. Path:
  /admin/structure/views/view/find_content_new/preview/page/ajax
  StatusText: Service unavailable (with message) ResponseText:
  PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has
  gone away in variable_set() (line 972 of
  /usr/local/www/drupal7/includes/bootstrap.inc).

I've searched around and couldn't find much on this error. I reinstalled Drupal, then Views and VBO. Still getting the error. Any help would be appreciated!


texts: How to perform a REST request after a node created using rules?

texts:
I have a backend service written by Python, which is exposed a JSON api. And I want drupal to perform an HTTP POST/PUT/PATCH/DELETE... request with json data (which is an output of a node) to the backend when a node have been created/modified/deleted.
I think that rules module should do this job. The trigger part and condition part are ok, but I can't find a suitable action part.
I hope to find a module that provides some rule actions, is able to let me define the JSON structure being used (using token etc.), is able to perform an HTTP request(GET/POST/PUT/DELETE) and let me handle the response (notify users or save to a status field).
When I google solutions, I only found two possible modules:

Rules HTTP Client, according to REST request through Actions and Triggers

This module adds an action wrapping of drupal_http_request() to use Rules for making HTTP requests.

But it seems not support authorization (OAuth/HMAC/token/...), and the data has to be HTTP query string (?name=value&name2=value2&...).

Web service client

This is a very powerful module, allows to define a series of actions: transform a node to a data structure and save as a variable, call http request with the variable and save the response as a result variable, handle the result at last. BUT, it only supports GET method (only option), query string, and no HTTP headers.
With these modules, I can work out a backup solution: my backend service may supply an endpoint that handles formed data, or supply an endpoint that receives a node id then make a HTTP request callback to Drupal (with services module).
Do I miss any module that do similar thing? Or is there any better solution?
P.S.: I'm not familiar with PHP, so I don't want to write any PHP code.


texts: Restrict node for anonymous user programmatically

texts:
First of all I've seen lot's of threads about restriction, but didn't find what I'm looking for.

So, my goal is to restrict the access for a specific node to anonymous users and when they try to enter that node, it will redirect them to the user/login page.

I was using Content Access module till now. It works like it should, but the problem is when this module is enabled, block caching is not working. As I know the Context module has the same issue.

I have one big menu block and without caching, the website is 4 times slower. When the Content Access module is disabled, the block is cached and the performance is great.

Let's say the url of the page is 'apple'.

I'm looking for a way to restrict only this page programmatically, without breaking the block caching.

I'm using Drupal 7.


texts: How to add a Related Products View for Commerce Kickstart?

texts:
I am trying to show related products in the products display for Commerce Kickstart. I tried using the method outlined in this tutorial but ran into a couple of issues:

The "Target Type" in the entity reference field (the field used for the related product) does not show "Node" as an option.
The SQL error mentioned in the tutorial appeared when selecting "Aggregate" in the view.

The bottom line is I couldn't get this to work of Commerce Kickstart.

Has anyone had any success in getting this to work for Kickstart, or an alternative approach?

Thanks in advance for any insight into this.


texts:
I am trying to make a simple block to put out some HTML. However, my block is not showing.   This is what I have from putting it together from different pieces of code.

function blue_block_info() {
  $blocks['blue_block'] = array(
    'info' => t('Blue'),
  );

  return $blocks;
}

function blue_block_view($delta = '') {
  $block = array();

  switch ($delta) {
    case 'blue_block';
      $block['subject'] = t('Blue');
      $block['content'] = blue_content();
      break;
  }

  return $block;
}

function blue_content() {
  return '
this is a test
';
}


texts: Writing a custom Rules Action for VBO- do I need to use Entity?

texts:
I have a list of email addresses displayed in a view. I'd like to parse those email addresses using a rules action, via VBO.

I'm trying to pass the email address to my rules action as a parameter, but it seems the only way I can do this is if I declare the email address as an entity first. Is that right or am I missing something? If there's an easier way, please let me know.


texts: Speed up AJAX loading on manage display page when moving fields among regions

texts:
When I'm switching my fields into different regions, it takes at least 20 seconds to make it change. I'm not able to change any other field while I wait. The only work around to this was to disable javascript which let me change the regions without the ajax load and then click the save button.

What other methods can one disable this ajax loading during region changes?


texts:
Hopefully this is a straightforward question.

I'm procedurally building nodes as I walk an XML feed, and am importing them into a production server.  I'm having issues importing node aliases, so I thought I could simply create links to the nodes as they will be on production (pathauto will take care of auto-aliasing them).

When I fill the href attribute of my link, instead of pointing to my website it points to my local server (it seems to be auto-changing my link).

I'm building my link like this:

$link = 'http://example.com/content/' . $current_node['name'];
$name = $current_node['name'];

and then assigning in my string

$output = "" . $name . "":

However, as I mentioned, it ends up pointing local instead of direct to my outside node.


texts: Menu theme suggestion ignored when cache turned on

texts:
I have an alternative main menu that is used on specific node types.
When turning on the cache the menu block is cached. The theme suggestion for the menu is then ignored.

I tried to disable the menu cache by changing the block preprocess cache settings. But the menu block is not called when using hook_preprocess_block.

Also I tried to change the menu / block by using the hook_page_preprocess

function bootstrap_custom_preprocess_page(&$variables) {
   //disable caches for every top header element
   //we do this as the dynamic header menu can't be cached - because of the landing page node type

   if(key_exists('top_header', $variables['page'])){
      foreach ($variables['page']['top_header'] as $key => $value){
        if(substr($key, 0, 1) !== '#'){
          $value['#cache']['max-age'] = 0;
        }
      }
   }
}

No success.


texts:
So I'm confused by the Menu Tabs functionality of Views 3 (Drupal 7 site).

My menu is organized like this:

  About-Us => /about-us
  --Management => /about-us/management
  ----Top-Management => /about-us/management/top-management
  ----Board-of-Directors => /about-us/management/board-of-directors

I have a View setup with two page displays and their paths are:
about-us/management/top-managers
about-us/management/board-of-directors

I configured the 'top-managers' page display to be a "Default Menu Tab"
I configured the 'board-of-directors' page to be a "Menu Tab"

For the Default Menu Tab, I had to provide a Parent Menu Item, so I selected "Normal menu item". I also tried "Already Exists" but that seemed worse.

So.. When I go to about-us/management/top-managers I get the correct page display, and there are tabs at top. When make the 2nd tab active ("Board of Directors"), the path changes correctly and I get the correct page display. But the 1st tab ("Top Management") links to the parent's path (about-us/management) instead of to itself (about-us/management/top-management).

So the 1st tab links to about-us/management and the 2nd tab links to about-us/management/board-of-directors.
I want the 1st tab to link to about-us/management/top-managers

How do I get the default menu tab to link to its own path instead of the parent's path? Or am I doing something completely wrong?