texts:
I have a module that i created for the sole purpose of integrating it with sitecatalyst.  If you are unaware of what sitecatalyst is, it is an api that helps create reports based on statistics of your website. EX: Pageviews, Visitors, etc.  Im aware there already is a module for omniture sitecatalyst but is not something i can really use.  I need to track many different variables as well as make it track when certain events fire.  EX: User Login, Create New Account, Comment Submitted, Search for something, etc.  Below i have code that fires everytime in preprocess_page, whenever a user logs in successfully, the properties i need set, and the setting of a static array with all the values i need to create the javascript code needed in order to track everything correctly.

My problem:
I used mymodule_user_login and launches as soon as a user logs in successfully.  I set all the properties and then set all those variables inside my static array.  However, the code in the preprocess_page gets launched everytime and therefore would overwrite the static array created when the mymodule_user_login function was called.  Can someone please help me how to figure out how to do this.  Ive been racking my brain.

Thank you in advance for any help

function mymodule_preprocess_page(&$variables) {
    if (arg(0) == 'admin') {
       return;
    }

    $props = retrieve_props();
    foreach ($props as $key => $data){
        mymodule_set_variable($key.'=', $data);
    }

    //CODE TO CREATE JAVASCRIPT CODE GOES HERE FOR SITE CATALYST
}

function mymodule_user_login(&$edit, &$account) {
    $props = retrieve_props();
    foreach ($props as $key => $data){
        mymodule_set_variable($key.'=', $data);
    }
    mymodule_set_variable('s.events=', 'event13');
}

function retrieve_props(){
    $props = array();

    /*Program Properties*/
    if (isset($_COOKIE['tsource']))
        $tsource = $_COOKIE['tsource'];
    else
        $tsource = 'Organic';
    $props['s.campaign'] = $tsource;

    $server = $_SERVER['COMPUTERNAME'];
    $props['s.server'] = $server;

    $header = drupal_get_http_header();
    if(isset($header['status'])){
        $pageType = 'errorPage';
    }
    else{
        $pageType = null;
    }
    $props['s.pageType'] = $pageType;

    $rel = getNodeRelation();
    $deg_level = null;
    $cat = null;
    $sub_cat = null;

    if (isset($rel['level']))
        $deg_level = $rel['level']['val'];

    if (isset($rel['category']))
        $cat = $rel['category']['val'];

    if (isset($rel['subject']))
        $sub_cat = $rel['subject']['val'];

    $props['s.prop1'] = $deg_level;
    $props['s.prop2'] = $cat;
    $props['s.prop3'] = $sub_cat;

    $schoolName = null;
    $program = null;
    $channel = null;
    $pageType = null;

    if(arg(0) == 'node'){
        $currentURL = drupal_get_path_alias($_GET['q']);
        $arrURL = explode('/',$currentURL);
        $channel = $arrURL[0];

        if ($variables['node']->type == 'school') {
            if (count($arrURL) > 1)
                $schoolName = $arrURL[1];
        }
     }
     else if (arg(0) == 'online-degree'){
         $program = arg(1).'-'.arg(4);
         $pagetype = 'program';
     }
     $props['s.prop4'] = $schoolName;
     $props['s.prop5'] = $program;

     $searchTerm = null;
     if (isset($_GET['textsearch']))
         $searchTerm = $_GET['textsearch'];

     $props['s.prop6'] = $searchTerm;

     return $props;
}

function mymodule_set_variable($name = NULL, $value = NULL) {
  $variables = &drupal_static(__FUNCTION__, array(), FALSE);

  if (empty($name)) {
     return $variables;
  }
  else {
     $variables['variables'][$name] = $value;
  }
}

function mymodule_get_variables() {
  return mymodule_set_variable();
}


texts:
I have content type = CD.
As there are many fields to describe each detail (artist, publisher, performers, band, producer etc.) i want somehow to give user option which field to pick.
Of course this works by default, but i would like some kind of checkboxes in block for example when adding node, so user picks only 3 of 15 if he wants, and then

If CD is compilation or you have many artist (Opera for example), user will proly use all fields, if CD is one man band he will use far less.

I hope i gave good explanation of what i want to acchive.


texts: I have a fivestar rating field "field_rate" in comments. I have only allowed a role "reviewer" to rate. if one reviewer say A sign in and rate the field the average is stored as stars. Now if another reviewer say B visits the same node, he can see the vote (overall avg of number of votes). I want that reviewers will not able to see each other rating so when reviewer B signs in he see only blank 5 stars instead of avg votes. At the same time i want editor role to view the average vote for that field. How can i achieve this?


texts: CDN module - serving files from subdomain - setup

texts:
Can plaease somebody point me to correct setup if I want my files to be served from subdomain?

As I understood I should choose origin pull mode.
Then create a subdomain.
Copy all files inside same structure to new subdomain.
In config details of CDN module add new subdomain

Should I add some rules inside htaccess of new subdomain?
Thank you very much for help.


texts: How to create a view of hierarchical taxonomy terms and their nodes?

texts:
I'd like to create an HTML sitemap viewable by a human. I mention that I'd like to keep the hierarchy (tree structure of categories with subcategories) like the following:

- TERM_A
  - Node a
  - Node b
- TERM B
  - TERM_B1
    - Node c
    - Node d
  - TERM_B2
    - Node e
    - Node f

For example, is it possible to display the results as grouped categories and sub-categories, by managing the order or results (relate to taxonomy term, sort by term weight and nesting level)?


texts: is getString() returning translated content?

texts:
$links['node']['#links']['node-readmore']['attributes']['title'] =

$entity->field_anc_label->getString();

I am using getString() value , need to know whether its translated or we need to call it under t() to get it translated ?


texts: Load a block contents dynamically / via AJAX?

texts:
I need to have a custom block on the page (will be sitewide) that has two states - one for when a cookie is present and has a certain value, and the other for when that cookie is not there or the value is outdated. Think of it like login states, but no authentication through Drupal.

What is the proper way to go about this with the block build() method? Do I implement a lazy loader that has the logic in it that builds the render array? Do I also add a cache context based on this cookie and its value so it is unique to those users?


texts: List of certain user flagged nodes in a view

texts:
I'm using Drupal 6.28 latest views and flag modules (for drupal 6 ofc). I have a node content type "group" which can be flagged. So I'm user with id2 I'll go on node/10 and flag it, then I'll go on node/11 also flag it. Now I want to display all flagged nodes by me on my user page /users/myname.

What I did so far:

1 Created a node view
2 Set up a relationship Flags: User's flagged content, checked Include only users who have flagged content. then chosen my created flag. (for content type "group")
3 added argument Flags: user uid
4 added field "title"

I have 2 flagged nodes but it shows nothing.. What I am doing wrong?


texts:
I'm using a multiligual site in french,english and arabic and i want to set a custom sitename (or logo) for each one,for ex: if my sitename for english is : "one two three" i want it "un deux trois" for frensh version .
Is there anyway to fix that?
Thank you very much


texts: Problem drupal with domain and redirection

texts:
I have problem with drupal site when migrate it from dev to production. My website works fine until I tried to login as admin. After enter username,password ,and click login I got error page not found. Because I were redirected to a wrong path. For example. I were redirected to www.domain.com/cgp/user but the correct path should be www.domain.com/user. Bellow is actual screenshot. Does anyone have the same problem and know to to fix it? Thank you.

Bellow is virtual host config

<VirtualHost *:80>
   ServerName www.domain.com
   ServerAlias domain.com
   DocumentRoot "/root_directory"
   ProxyPass /  http://webserver_id/cgp/
   ProxyPassReverse /  http://webserver_id/cgp/
   ErrorLog "logs/cgp-error_log"
   CustomLog "logs/cgp-access_log" common
   # redirect non www to www
   RewriteEngine On
   RewriteCond %{HTTP_HOST} !^www\. [NC]
   RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</VirtualHost>


texts: Howdo I display all the images from a field in a view?

texts:
I'm trying to display multiple images from an image field in one view as an Owl Carousel, but I only see a maximum of 5 images to be displayed there.
Googleing it, I found that there's an option ALL, that should display all of the images, but it just doesn't appear to me, so do you know what do I need to configure to enable ALL the images in that field?

General setup: I'm using Drupal 7x, with a sub-theme from Bootstrap and Views 7.x-3.20.

Views setup: it was created as an Unformatted list and it's showing just Fields one of them is the image field you can see below.

In the red box I've seen the ALL option, but it just doesn't appear in my setup.

Thanks,
Daniel.


texts: Views api: how to create a 'conditional' join

texts:
I have 3 tables:

Table 1      Table 2            Table 3
id_1 [...]   id_1, type, id_2   id_2 [...]

I want to join table 1 to table 3 by way of table 2. This is easy enough,eg.

$data['table3']['table']['join']['table1'] = array(
  'left_table' => 'table2',
  'left_field' => 'id_2',
  'field' => 'id_2',
);
$data['table2']['table']['join']['table1'] = array(
  'left_field' => 'id_1',
  'field' => 'id_1',
);

However, the intermediary table also has a 'type' attribute in it. What if I want to specify, as part of the join, what the type is? eg. I want something like this:

SELECT id_a.table1 FROM table3
LEFT JOIN table2 ON table3.id_2 = table2.id_2 AND table2.type = 'blah'
LEFT JOIN table1 ON table2.id_1 = table2.id_1;

To be clear, I want the condition to the part of the join, not after the fact (as a filter will remove null rows).


texts: Drupal 7 - Suppress output of nodes on Taxonomy Pages

texts:
Is there a way to suppress the output of nodes on taxonomy pages, without having to install a module (i.e. just in template.php)?

Nodes tagged with a taxonomy term appear on the "Taxonomy Index page" (e.g. yoursite.com/taxonomy/term/[id]).

New in Drupal 7, Taxonomy Index pages can have fields attached to them. However, if you try to over ride the taxonomy page with a View (for example, to control how the nodes are displayed), the fields on the Taxonomy Index pages will not appear.

I have therefore placed my Taxonomy View as block on the Taxonomy Index page. That way, I can control how the nodes appear and still have the Taxonomy Index page fields.

Because of this, the taxonomy page is still outputting its nodes. I can hide them by setting the teaser of the nodes to hidden, but it still loads up the nodes (and therefore any CSS/Jquery attached to nodes even though the nodes aren't being displayed). How can I suppress the nodes from appearing, ideally from inside of template.php?


texts:
I know how to get a "more like this" block for an individual piece of content (as a block in a panel, or whatnot), however these functions don't seem to work with the results of a View.

My site has a few pages that list the content of a specific taxonomy term (Industry).  Each content type listed has an additional taxonomy term associated (Focus Area).

The view that is presented on the site allows the visitor to select the Focus Area, which when selected, limits the content on the page to matched terms.

I'm trying to get a "more like this" block for the results of the view.  There may be other content that matches the Industry and Focus Area (such as an Event or a Career) that we would like presented.

Bonus points if you can help me make the Focus Area selection persistant across the site (so that when the visitor navigates to a different Industry page, their selection for Focus Area is remembered and applied).

Use of Solr is a possibility as well.  We haven't turned it on while in development, but is part of the plan.

Thanks in advance.


texts: Adding create, edit, delete link of referenced entity in same content type

texts:
How could we interconnect referenced entity in one content type so that we can search, create, edit, delete the referenced entity on the same content page.
In drupal 7 "references_dialog" module was fulfilling the requirement but now in drupal 8 what is alternative of that module.I think references_dialog is now no more maintained by developer for Drupal 8. I already know that inline_entity_form is there but i want some module which open every thing in modal window pope up like reference dialog does.

Any module or code suggestion will be great.


texts: Show all field values in Drupal through a View

texts:
I have a field named "Programs" in my content type. It's a Multi-select List. With every new node, I select one or more Programs through the multi-select list.

Now I am hoping to show all of these "selected" values of the field Programs, that I selected in all the nodes I created.

As an example, if these are the list values in the field "Programs"

Chemical Engg.
Computer Sc.
Arts
Electrical Engg.
Info. Systems

and if I created (let's say) 5 nodes, in which I selected these fields in the following manner:-

Info. Systems (Node 1)
Arts, Electrical Engg. (Node 2)
Info. Systems (Node 3)
Computer Sc., Arts, Info. Systems (Node 4)
Arts (Node 5)

Now, my question is how to show these "selected" Field values through a view?

Notice, I wrote selected as I only want to show the field values which have been selected in the node.

So, my view would show the following values (notice Chemical Engg. is not here as no node selected it.):-

Computer Sc.
Arts
Electrical Engg.
Info. Systems

Thanks.

Update

I created a view that displays the nodes of my content type and added the field 'Programs' to it, but the only problem is that it shows comma separated programs if I selected more than one programs with a specific node. I just need it to show one program, as the user can select the programs and see all nodes associated with it.


texts:
I have a Drupal 7 site I want to upgrade to Drupal 8. I take this occasion to rethink the structure and theming, but I would like to extract/copy/move/import the book content from the original site into the new one. (I cannot use Drush.)

I can export the book content using a view. How do I add the book structure? I found a relationship to parent, but I don't know how to use it.


texts: Unable to add custom validation rules using client side validation module in Drupal 7

texts:
First I want to clarify that I am new to Drupal. So please excuse me If my question is naive.

I have installed the Client Side module in Drupal and it is working fine for all the required fields. I have built a custom form using Drupal form API. Now I want to add some custom rules to some of the fields on the from. I have searched on the internet and found this https://drupal.org/project/fapi_validation and below is the code that I have implemented but this is not working. I think there is some thing that I am missing here.
The module name is instructor_registration and I have written this code in instructor_registration.module file.

function instructor_registration_fapi_validation_rules() {

return array(
    'select_required' => array(
        'callback' => 'validation_rule_select_required',
        'error_msg' => 'Please select %field',
    ),
);
}

function validation_rule_select_required($value) {
if ($value == '0') {
    return FALSE;
}
else {
    return TRUE;
}
}

In the form element I am calling this as :

'#rules' => array('select_required'),

If there is any other information required from my side then please let me know.


texts: Error while opening in write binary mode in module installation

texts:
I wanted to install a module for SSL, but when I go to "install new module" and enter the .tar.gz file and click install this error appears:

Error while opening {temporary://update-extraction-6f1a1322/securelogin/securelogin.info} in write binary mode

I don't know why and I didn't find any thing over the net.
please help me
thanks a milion :)


texts: CKeditor stripping allowed style attribute

texts:
I've installed Colorbutton to my Drupal 8 site.

I have enabled the button for Full HTML and For Basic HTML

I have allowed the attribute <span style> in the Basic HTML allowed attributes area.

I have defined a set of hex value colors.

When I edit a page the button appears and I can change font colors in the editor correctly, however, saving the page strips the attributes leaving only clean <span> tags...

what else am I suppose to do?

There is a simmilar question here, however in relation to colorbotton the documentation/README that comes with the module specifically states that we should be allowing <span style> in the allowed tags? Is their readme incorrect?

The extension appears to add the color by adding the attribute style="color:#fff"> How can I allow it to do this successfully?


texts:
I've set up a View which displays the latest posts of a custom content type. Its fields are the usual, such as image, summary and title.

Though I would like the name of title that the View displays to be different than the original.

So for example the name of the title in the content type is Location of Project. Rather, I would like to have the View title only display Location. The titles' output would continue to show the same information, for example Canada.

Couldn't find a way to achieve this using the Views config. Any help would be appreciated.


texts: (Nearly) single page website - any clever ways to manage menu anchor links?

texts:
So,

I am creating a (nearly) single page website. It has a one-page homepage, plus a contact page and a ToS page which are standalone pages. The menu links on the homepage are like '#intro', '#whatwedo', etc, but on the standalone pages I need the links to be 'site.com/#intro' so that it links them to the anchor on the homepage.

How is the best way to achieve this without having two menu blocks?

Cheers


texts: Diagnosing slow requests between Varnish and Nginx

texts:
I have been trying to diagnose slow page load time in my local Drupal 7 environment when using Varnish.

My local environment runs in Docker using docker-compose. I have a containerised Varnish instance, and another container with Nginx and PHP-fpm running in it. The Varnish instance listens on port 80 and caches correctly. The slow page load times occur when a page is not available in the cache and Varnish has to request it from Nginx. Nginx runs on port 8080. I'm also able to request the homepage of my site directly from Nginx on port 8080, bypassing Varnish altogether.

I've been timing requests to my homepage with curl:

Direct to Nginx on port 8080:

curl -w%{time_starttransfer} -o /dev/null -s "http://localhost:8080"
1.152%

Via Varnish, but with a random string to force the request to come from Nginx:

curl -w%{time_starttransfer} -o /dev/null -s "http://localhost?9"
13.896%

As shown by the figures below the commands, a request to Nginx on port 8080 takes around 1 second, whereas a request to Nginx via Varnish takes almost 14 seconds.

I've examined the Nginx logs and the transfer times shown there are almost the same as the transfer times shown by curl. This suggests to me that the problem lies in Nginx or PHP-Fpm, rather than Varnish itself. Perhaps there's something different about the request Varnish makes to Nginx compared to requesting the page from Nginx directly?

I've tried profiling the performance using XHProf. When making the request via Varnish, XHProf shows the _drupal_shutdown_function() as having an EWall% of 78%, apparently accounting for a large part of the page load time.

When making a request directly to Nginx, _drupal_shutdown_function() does not even show up on the XHProf report.

Strangely, I've tried commenting out all the code inside _drupal_shutdown_function(), but when making another request via Varnish, page load time is unchanged.

Could anyone explain why XHProf reports _drupal_shutdown_function() as being so slow?
Is it possible that XHProf is showing misleading data and that the _drupal_shutdown_function() issue is a wild goose chase?
Could there be another difference in the way Varnish requests a page from Nginx compared to a direct request from Nginx that would account for the slow page load time?

Thank you!


texts: Is there a way to get field associated with content type?

texts:
I have to do some functionality with fields associated with a content type, this i have to do before creating content for it.

In custom module tried using node_type_load('digital_iq_2012'), this function loads content type details alone and not the fields associated.

Do we have a way to get the fields as well?

Any help?


texts:
The theme I am building is responsive and so many images have max-width:100%; applied in CSS. Can I use a hook in template.php to strip the height attribute from img tags because it is causing lots of distortion issues, and how would I go about this?

Thanks for your time!


texts: How to sql-sync prefixed multi-site installations within the same database with drush?

texts:
I am running several Drupal 7 multi-sites that share same code base as well as the same database with prefixed tables per multi-site (some tables are shared too).

I chose this setup, because i need several sites, each representing a region. They share the same code but not the same content. (This is why i didn't chose Domain Access). The reason, why all multi-sites share the same database instance with prefixed tables is because i need cross-multi-site queries to aggregate global information. A context-switch within one database (by changing the table prefix whith db_set_active) is much "cheaper" than initializing a new database connection for every of the N regions.

Now I need to sync the data of one multi-site with the data of another multi-site within the same database. I thought Drush could easily do the job with:

drush sql-sync [from multi-site1] [to multi-site2]

But i recognized, that the sync is done per database and not based on prefixed tables... That sounds logical!

So the command above would sync *[same_database]* with *[same_database]*, but what i need is a script that runs like this:

sync [all prefixed1_ tables] with [all prefixed2_ tables] within same database

Now my question: Has anyone worked on synchronization of multi-sites within the same database before, or has anyone a hint on best practice for my synchronization-needs?

Edit: I found out, what my needs really are. Drush's sync is not a real "sync" it is more like a "export from and import to". So it is quite more simple than a complete synchronization-task with "insert", "merge" and "delete". So i am going to write my own drush's script to fulfill my needs.


texts: Error after updating Webform from 8.x-5.0-beta15 to 8.x-5.0-rc1

texts:
A Drupal 8 site hosted on Pantheon gives this error message after updating Webform from 8.x-5.0-beta15 to 8.x-5.0-rc1:

The website encountered an unexpected error. Please try again later.
TypeError: Argument 1 passed to Drupal\webform\WebformTokenManager::__construct() must implement interface Drupal\Core\Config\ConfigFactoryInterface, instance of Drupal\Core\Extension\ModuleHandler given, called in /srv/bindings/261ff5c4a9e04814be06a20de36ae33a/code/core/lib/Drupal/Component/DependencyInjection/Container.php on line 266 in Drupal\webform\WebformTokenManager->__construct() (line 46 of modules/webform/src/WebformTokenManager.php).

The site is completely down at that point and we have to revert to a backup.
Any suggestions?


texts: Drupal 7: Find which user created a given user

texts:
I have a number of users admins (group: "users_admin") who create users who can view content (in many groups, like "students_a", "students_b", "students_c", and so on).

Is there a way to filter the users by their creators?

Let me clarify:

User "A" from "users_admin" create a user "S1" in "students_a".
User "B" from "users_admin" creates a user "S2" in "students_a".

I would like to be able to differentiate users created by "A" and "B", has anyone done that before? Is it possible?

I hope I made myself clear enough; please tell me if you need some clarifications.

Thanks in advance for you insights!
Regards


texts: Full website translate in multilingual website

texts:
we are developing a multilingual site.
We have done all setting like installing Internationalizatio,Entity Translation and enabling local and content translation modules etc.

but there are some content which no get translate on choosing particular language, We want to translate my full website content on choosing particular language.
How can I perform full transable website in multilingual site?


texts: How to pass exposed filter value to Rewrite URL?

texts:
I have search filter criteria in the view.I need to pass the exposed filter value to the title field to rewrite URL.

Please let me know how to get this exposed filter value in the rewrite URL.


texts:
I want to deploy my drupal project to higher environment - DEV -> QA --> Staging --> Production. So i understand the following moving parts

1) Drupal code - everything inside var/www/html. (this is automated using Jenkins once we check the code in GIT.)
2) Database (manual)
3) File system - we are using S3. (Manual).

I would like to do incremental push to higher environments - i do not want to dump the complete DB for every release.

If clients add few modules in Staging environment or do some setting changes in staging and production environment, how to retain the information when i do a next release? Please help.


texts: How do I edit the response of successful register.json?

texts:
How can you edit the Services' json response of successful register.json to include the user's OR system's auto-generated password, plus any token?

I've tried a variety of combinations of the commented code below..

function logintoboggan_process_login($account, &$edit, $redirect = array()){
  global $user;

  $user = user_load($account->uid);
  watchdog('login debug', json_encode($edit)); // AT THIS POINT I CAN VERIFY WE HAVE THE PLAIN-TEXT PASSWORD
  //user_login_submit(array(), array('uid' => $account->uid));
  user_login_finalize($edit);
//  $user = user_load($account->uid);
//  $user->token = drupal_get_token('services'); //WE HAVE A TOKEN ALTHOUGH I DOUBT THIS WOULD WORK.
//  user_login_finalize($edit);
//  module_invoke_all('hook_user_login');
//  module_invoke_all('tripchi_user_login');
//  module_invoke_all('logintoboggan_user_login');

and even also tried hacking the drupal core on line 3888 of "/modules/user/user.module":

elseif (!$admin && !variable_get('user_email_verification', TRUE) && $account->status) {
      global $user;
      $user = user_load($account->uid);
      watchdog('login debug', json_encode($edit));  // AT THIS POINT I CAN VERIFY WE HAVE THE PLAIN-TEXT PASSWORD AND TOKEN AVAILBABLE!
      //user_login_submit(array(), array('uid' => $account->uid));
      user_login_finalize($edit);
    //  $user = user_load($account->uid);
    //  $user->token = drupal_get_token('services'); //WE HAVE A TOKEN ALTHOUGH I DOUBT THIS WOULD WORK IN TERMS OF SESSION PERSISTANCE
    //  user_login_finalize($edit);
    _user_mail_notify('register_no_approval_required', $account);
    $form_state['uid'] = $account->uid;
    user_login_submit(array(), $form_state);
    drupal_set_message(t('Registration successful. You are now logged in.'));
    $form_state['redirect'] = '';
  }

if one of my test lines don't break the call altogether, on success the call just replies:

{
    "uid": "499",
    "uri": "http://localdrupal.tripchi.com/drupalgap/user/499"
}


texts: Filter entities in a view by referenced entity

texts:
I am creating a website in Drupal 8 that shows info about team members of a business.

I've created two new content types:
- Department
- Team Member

I've created an entity reference field in team member that refers to the department he/she works for. The relation is many to many so I allowed multiple values.

Now I want to create a menu item for each department and when clicked a page shows with the team members working for that department.

I am totally new to Drupal so please explain steps in details :)

I've tried creating a view and add "Entity Reference" but I don't know how to proceed after that.
I also tried to add a filter criteria but didn't work as well.


texts: Simple string replacement in views output?

texts:
In Drupal 7, for a view where I wanted to replace every instance of 'am' with 'a.m.' (with a similar replacement for pm/p.m.) in the output, I did this:

function mymodule_views_post_render(&$view, &$output, &$cache) {
  if ($view->name == 'target_view') {
    $replace_pairs = array(
      ' am ' => ' a.m. ',
      ' pm ' => ' p.m. ',
    );
    $output = strtr($output, $replace_pairs);
  }
}

How do I achieve the same result in Drupal 8? The documentation for the D8 version of hook_views_post_render() is broken/incomplete, but it does mention strtr(), so I imagine something similar should work.

I've already figured out that my if statement will need to test against $view-storage->id() instead, and I've noticed that $output is an array (rather than a string) in D8, but I'm not seeing anything appropriate to target in that array. I am new to D8; can someone show me the way?


texts: Commerce 2 order receipt email – how to hide and then output later the shipping method in the twig email template?

texts:
We have a custom TWIG email receipt template that is outputting the shipping method from the shipping_information variable.

The TWIG template is using the default code to output the shipping information:

{% if shipping_information %}
 <td>
     {% block shipping_information %}
      {{ shipping_information }}
     {% endblock %}
 </td>
{% endif %}

The code above outputs the shipping method along with the shipping_information variable. We'd like to not output the shipping method here and instead output it later in the template.


texts: How do I include custom CSS files in the styles dropdown?

texts:
I am trying to include custom css file to ckeditor.

It doesn't show css file in styles drop-down list.

I have included this two lines of code into;

 /drupal/sites/all/modules/ckeditor/ckeditor.config.js

 config.extraPlugins = 'stylesheetparser';
 config.contentsCss = 'test.css';

Thanks a lot for the help.


texts: No matter which size is my viewport, the narrow.css file is the only one triggered with IE7 and IE8 in my Omega site

texts:
I´m using Omega theme in D7.
After configuring all the .css files to achieve an adaptive design, I realize that ie7 and ie8 looks like hell.

The problem? The different css files (that have different codes according to different mediaqueries) are not triggered.

No matter which size is my viewport, the "narrow.css" file is all I see.
Not even the default.css

Is there a workaround to this?

Thanks!


texts: in views row-template, how to obtain rendered output of each item in multi-valued field?

texts:
I have a custom row template, and I know I can obtain the rendered field output with:
$field_output = $view->render_field($fieldname, $view->row_index);

For a certain multi-valued field, I would now like to create an array of the rendered output of each item in the field.
$field_output[3] = rendered field output for 3rd item in my multi-valued field

Anyone know how I can do this?
UPDATE:
There are two approaches I am aware of, but neither is a good, robust solution.
Approach #1:  get_values()
One approach is to call get_values, and then grab the safe_value:
$vals = $view->field[$fieldname]->get_value($row);
$field_values = array();
foreach ($vals as $i=>$v){
  $field_values[$i] = $v['safe_value'];
}

The problem with this approach, as described here, is that (a) it breaks localization and (b) some fields do not have a safe_value.
Approach #2: render_field()
The second approach (see below) uses render_field() and then explodes the result:
$field_values = array();
$field_output_str = $view->render_field($fieldname, $view->row_index);
if (!empty($field_output_str)){
  $separator = ',';
  $field_values = explode($separator, $field_output_str);
}

The problem with this approach is that, in addition to exploding multi-valued fields, it also explodes individual fields that contain commas, such as text fields.
Does anyone have a better, more robust solution?


texts: Send email notification when a new comment is posted

texts:
I'm using Drupal 8.1 with Rules 8.x-3.0-alpha1.

I want to create a rule to send an email to the author of a node when a new comment is posted to this node. Problem is I didn't get the email address of the author with rules because the dataset gives me only this values: @node.node_route_context:node or comment but under comment I didn't find anything like comment:node:author. In Drupal 7 I have this data. What I have to do in Drupal 8?


texts: How to add form on ubercart checkout complete page?

texts:
I have latest Ubercart 7.x-3.6 on Drupal 7.31 installation.
I want to add a form on cart/checkout/complete page. which api can I use to add a form on checkout complete page.

EDIT:

Ubercart's core cart checkout complete page contain an order submit message and created order link, right? Now I want to add a form bellowed to the contents of checkout complete page. I think its enough detail.


texts: How to get the URL of the entity reference node?

texts:
I'm building a site of course video，one course includes many video clips. I have created 2 content types, one is for the Course ,and the other is for the Video.

In the course content type, I set a field of entity reference to make a relation between course and video.

And then I create a view to display the video list on the video node page, it works. I wonder how can I add the link of the relative course node page on this video node page, how can I get the URL of the entity referenced course node page?

Any help would be great! Thanks in advance.


texts: open a modal just before submit to get an answer yes or no and then submit

texts:
I'm altering a comment form and on my page i want to show a modal to ask the user for an answer then i will submit.

I tried to drupal_get_form on a ctools modal but a lot of problem on submit it will return to the same submit page and an outher problem with the form_i can not get.

is there any good example or a good idea to do that?


texts: OG context not passed in Entity Reference View Widget

texts:
I am using Entity Reference View Widget module (ERVW) and set its view to have two args, 1st arg being the "Content: nid" set to "display all" on no filter value while the 2nd arg is "OG Membership: Group ID" set to "Get OG from context" on no filter value.

Aside this, I have set a contextual link on the group page "Add Something" using Contextual Admin OG module and page manager. Along with this on group content type, the og_group_ref field is pre-populated by checking the option "OG Context" using Entity Reference Prepopulate module.

Now on the node add form (reached through the above "Add Something" link on group page), the og_group_ref is populating correctly but when I click "Add Items" link for ERVW, it does not get OG from context hence resulting in listing all content (nodes). However, being nid as 1st arg and "Pass select ID into view" option selected in field settings, the selected node in modal window is exempted from the list when the modal window opened again. So the passing ID thing is working fine.

Further, if I set a fixed value of OG it does filter the content and pass selected IDs into view as well. I have tried to get Raw Value and Content ID from URL with no luck. Can somebody point me in the right direction?


texts:
I want to migrate nodes from a drupal 6 site into a fresh drupal 7 site.
Looking at the node export module, under *Migrating nodes between Drupal versions
* it says you need to enable node export feeds and use the feeds module in D7 to import. Obviously I downloaded and installed the node export module and enabled all the submodules, but there simply isn't any node export feeds module listed within those.

All I'm seeing listed on my sites modules page under node export is:

Node export
Node export DSV
Node export features
Node export files
Node export relation
Node export serialize
Node export XML


texts: Can Views output clean URLs from titles with quotes, and other special chars?

texts:
I have a view that really needs some nice clean URLs; the links are the titles of the content items in the view.

I am pretty sure I have been able to clean up URLs with views before (I could be wrong though), but I just can't seem to find it today.
Removing spaces is simple enough but I need more.

Any help greatly appreciated.


texts:
I am using the Business Hours module. It allows you to specify two time periods per day, for the 7 days of the week. So you could, for example, say: 9 t 1 Mondays to Fridays, and 2 - 5, Mondays to Fridays.

My problem is getting access to these values as I need to expose it in a custom module. With print_r($node), I can see the following.

[field_office_hours] => Array(
  [x-default] => Array(
    [0] => Array(
      [day] => 0
      [starthours] => 900
      [endhours] => 1700
    )
    [1] => Array(
      [day] => 1
      [starthours] => 900
      [endhours] => 1700
    )
    /* Omissis */
  )
)

I have no idea how to get this as array. I know that the module requires the "Date" module, so these are probably Date fields, but how do I actually get the values as array?

$node->field_office_hours->value doesn't work.


texts: Does not Show markers depending on Node ID via Openlayers

texts:
I have a problem in OpenLayers Map.The name of the URL path is localhost/restaurant-dp/?q=view_map/1 , I pass node id to Open Layers Map view, I got Map ,But doesn't show markers with Map.

List of following setting done my view.

  Format: OpenLayers Map | Settings
    -  click settings then Map :OpenLayers Locator Node Map

 Contextual filters :  Content: Nid  -> Provide default value : Content ID from URl

Here, What did I do Wrong ?


texts: Views related content based same term names in different vocabulary

texts:
I'm trying to create a view for a taxonomy term and show a related content based on term name.

For example, i have term name Manchester United in vocabulary teams and i want to show all news nodes that have term Manchester United. The problem is that terms in news are in different vocabulary.

For now i create a View with Contextual filters Content: Has taxonomy term ID which get me ID for term Manchester United from vocabulary teams.

My questions is, how i can use this term name and show related nodes from news which have same term name but in different vocabulary and different ID.

EDIT: it's important to know that i'm getting first term by his ID in url.


texts: How to add exposed custom filters in Apachesolr Views Integration

texts:
I am currently creating an application which manage a long list of persons, with a lot of fields. By doing that:

function creamodule_views_data_alter(&$data){
   $data['apachesolr_node']['sort_ss_availability_date'] = array(
   'title' => t('Availability Date'),
   'help' => t('Only real dates, not relative ones'),
   'sort' => array(
       'handler' => 'apachesolr_views_handler_sort',
   ),
   'argument' => array(
       'handler' => 'apachesolr_views_handler_argument',
   ),
   'filter' => array(
       'handler' => 'apachesolr_views_handler_filter',
   ),
   'field' => array(
       'handler' => 'apachesolr_views_handler_field',
   ),
   );
}

I am able to sort the data, but I can't filter them. The filter is available, but is broken when I select it. Does someone know how to do that, or where I can find some resources explaining how can I have this done.thank you.


texts: Display user picture below content type article

texts:
How can i display user name and picture below node article.
My theme is based on panels so i dont know where to write code for it. Or any admin option.

Thanks


texts: Is there a significant performance difference between the Computed Field module and writing code?

texts:
When I got started using Drupal 7, I added several fields to my site using the Computed Field module (to calculate age, zodiac sign, and so on).

Now that I have been using Drupal 7 for a few years, I realize that it is generally not a great practice to write PHP code in the UI, as the Computed Field module requires.  But, the code I am using has worked for the past few years, so that is no longer an issue.

However, I am wondering if there is a significant performance difference between using the Computed Field module (saving the result in the DB) vs. running the PHP in hook_node_presave() or in a similar fashion somewhere in a custom module.

Would removing my computed fields (and uninstalling the Computed Field module) and replacing them with fields in a custom module significantly increase performance?


texts: How to use Views and Rules to activate a new node flag for existing OG members?

texts:
We have a flag for nodes called subscribe_og.

From this point in time users will click that flag to join, or leave, a group.

If you are not a member of the group, the flag says 'Join'. If you are a member the flag says 'leave'.

Old members of a group currently see 'leave' as they have not clicked the flag.

Is it possible to use Views and Rules to generate a list of group members, check if they have have activated the node flag, and if not, activate the node flag for them?

I had a little look at Rules Components and came up with this, which seems to do nothing.

    { "rules_gerw" : {
    "LABEL" : "gerw",
    "PLUGIN" : "rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "flag", "og" ],
    "IF" : [
      { "NOT flag_flagged_node" : {
          "flag" : "subscribe_og",
          "node" : [ "site:og-context--node" ],
          "flagging_user" : [ "site:current-user" ]
        }
      },
      { "AND" : [
          { "og_user_in_group" : {
              "account" : [ "site:current-user" ],
              "group" : [ "site:og-context--node" ],
              "states" : { "value" : { "1" : "1" } }
            }
          }
        ]
      }
    ],
    "DO" : [
      { "flag_flagnode" : {
          "flag" : "subscribe_og",
          "node" : [ "site:og-context--node" ],
          "flagging_user" : [ "site:current-user" ],
          "permission_check" : "1"
        }
      }
    ]
  }
}


texts: CCK Field Table in Database and Content Type

texts: I am creating some fields in a Custom Created Content type. What I have already seen as per my experience is that their is a table for each field that I have currently in the Content Type. But now I am adding new fields to that content type from 'Admin -> Content Management -> Content Type -> Edit Custom Content Type -> Manage Fields'. Here I am creating some fields but I dont get a table for them. Why is CCK not creating tables for these fields?


texts: allow user to sign up for different role

texts:
I am new to drupal, so any help would be appreciated in advanced. My requirements are as follow.

1 happened in signed in user environment.
1 :" there must be groups. and they will be assigned under one user (role: manager) only he can manage the user (create,update,read and delete)" - need to be solved

* There will be a user with (admin permission) will be able to manage groups including manager * solved**

in home page : guest environment
2: "User must be able to choose which group they wanna go in: But they might need to be approved by group manager or admin before they can use their account"

for 1: i found some modules like organic group/sub-user

for 2 : i found some modules like multiple registration/ advanced registration (i don't think that gonna make it)

So please, Drupal masters, if you happens to know how to full fill those requirement with drupa stuff like Field, views or whatever. Do let me know. THANKS!!


texts: Is there an accordion-style menu module?

texts: I have been searching high and low for a module that integrates an accordion-style menu system in D7, similar to http://drupal.org/project/accordion_menu. Anybody know of one?


texts:
I have two content types (document and employee) and both have a reference to a taxonomy (language). I would like to build a view showing all documents that a employee could read. In other words, both of them have the same language.

I've try to relate the employee and the taxonomy; however, I can't see a way to relate the taxonomy to the document. I've also tried to relate directly the employee language ID to the document language ID, with no success.

Do you have any idea to solve this problem?


texts: Why can I only view content published to current domain?

texts:
I'm using the Administration Views modules and Domain Access. When I'm logged in as the Administrator (user 1) I can view any content across all domains at /admin/content no matter what domain I'm on.

When I'm logged in as another role (Role X), who has permission to edit any content on any domain I can only see content published to the current domain. What permission or view setting or other setting do I need to apply to allow Role X to see content published on any domain no matter what domain they're on?

The only way Role X can see everything is if I give them the "Bypass content access control" permission, which I'd rather not.


texts: ACL, Node, and User exists in DB, but still no access

texts:
Trying to write a custom module tying in ACL with commerce_license (to purchase access to content), but I'm not sure I'm implementing the ACL API correctly. Everything seams to be in the database, however. I'm probably missing a step, but I'm not sure what that is.

User is uid 3. Node I'm trying to access is node/23. ACL is 16.

ACL is listed in acl table. Node is listed in acl_node table, with grant view only. User is listed in acl_user table.

mysql> select * from acl WHERE acl_id = 16;
+--------+----------------------+-----------+--------+
| acl_id | module               | name      | number |
+--------+----------------------+-----------+--------+
|     16 | commerce_license_acl | ACL_4_23  |   NULL |
+--------+----------------------+-----------+--------+

mysql> select * from acl_node WHERE acl_id = 16;
+--------+-----+------------+--------------+--------------+----------+
| acl_id | nid | grant_view | grant_update | grant_delete | priority |
+--------+-----+------------+--------------+--------------+----------+
|     16 |  23 |          1 |            0 |            0 |        0 |
+--------+-----+------------+--------------+--------------+----------+

mysql> select * from acl_user WHERE acl_id = 16;
+--------+-----+
| acl_id | uid |
+--------+-----+
|     16 |   3 |
+--------+-----+

I've noticed that in the modules that use ACL, there are calls to "node_access_acquire_grants($node)" after the calls to  acl_create_acl($module_name, $acl_name), acl_add_user($acl_id, $uid), and acl_node_add_acl($nid, $acl_id, $read, $update, $delete, $priority), so I've added that, too. However, I'm still missing something. The acl data seems to be being recorded, but the node access records are not. I'm using content_access (which also uses the acl module), but not getting the behavior I want.

What am I missing?


texts:
I tried to register two custom block in my custom_blocks module with the following code.

function custom_blocks_block_info(){
  $blocks = array();
  $blocks['featured_items'] = array(
    'info' => t('Featured Items'),
    'status' => TRUE
  );
  $blocks['workflow_illustration'] = array(
    'info' => t('How it works'),
    'status' => TRUE
  );
  return $blocks;
}

function custom_blocks_block_view($delta = ''){
  $block = array();
  switch ($delta) {
    case 'featured_items':
      $block['content'] = featured_items();
      break;
    case 'workflow_illustration':
      $block['content'] = workflow_chart();
      break;
  }
  return $block;
}

But the    problem is 'Featured Items' block is shown in the block administer page. But the 'How it Works' block is not shown (may be not registered :?) in the block administer page.

I tried deactivating the module >> clear drupal cache >> clear browser cache (?) >> activate the module again.

Still the 'Featured Block' is the only block showing up. Please help me to get my block accessible via block administer page.


texts: Will Drupal 8 Twig have template inheritance like Drupal 7?

texts: Drupal 7 you can style down to the fields on the page will we have this type of control with twig? I have reviewed a lot of documents about twig and didn't see anything that lets you have that same inheritance as the Drupal 7 template engine. If this is not built in to twig, is Drupal 8 going to be building it in?


texts: How to prevent CKEditor from removing content and tags written in source?

texts:
I'd like to be able to use things such as the  tag for purposes of using font awesome icons, but CKEditor strips tags like this. If I place
 when in 'source' mode in ckeditor it gets removed as soon as I return to the standard mode. Is there a way to ensure that ckeditor allows these tags?

I saw that someone provided a solution here How to stop CKEditor 3.6.3.7474 from stripping <script> tags however in drupal 8 admin/config/content/ckeditor/edit/advanced does not exist.

I also saw the CKEditorPluginConfigurableInterface here https://api.drupal.org/api/drupal/core%21modules%21ckeditor%21src%21CKEditorPluginConfigurableInterface.php/interface/CKEditorPluginConfigurableInterface/8.2.x
But I wasn't sure how to make use of that.

Is there a way to prevent CKEditor from removing content and tags written in 'source'?


texts: How to disable and grey out a form button if the textfield is empty?

texts:
I have a custom module built, and I would like to grey out and disable the submit form button if the textfield is empty.  Can anyone help?

Here is the code for the textfield and the form button:

$form['ro-user-details']['nickname'] = array(
    '#type' => 'textfield', '#width' => 50,
    '#title' => t('Nickname'),
    '#default_value' => $ro_user->nickname,
    '#size' => 50,
    '#maxlength' => 200,
    '#required' => TRUE,
    );

    $form['ro-user-details']['change_nickname'] = array('#type' => 'submit', '#value' => t('Change Nickname'));


texts: Drupal 8 views slideshow not displaying images

texts:
I created a content type with title, body, and slide (image) fields. I created a view block (format: bootstrap carousel, fields: slide).

After I place the block in a region, I see the slideshow block, but I don't see the image. I only see blank slideshow on my site and views.

How do I display images in the slideshow?

Views > settings next to format > selected image field to display.


texts:
I am not able to find out how can I add a custom link at the bottom of a page (like in the image below - "hlee's blog"). When I click on the 'Edit' tab, there is not html/code for that link. I need to add another link on this page but have no clue where the setting/code is.

Thank you.


texts: I have a view containing objects of a custom content type. Could anyone please tell me how I could allow my users to search only objects that have certain attributes? Some sort of like "Show me objects that are located in X, have a size of Y and colour Z".


texts: Views field that links to fragment URL of comment on /node/ instead of /comment/

texts:
With Views, I want to output a list that links to each comment of the current node. But instead of linking to

/comment/42#comment-42

I want to link to

/node/23#comment-42

I tried these fields, but they all link to the URL in the /comment/ space:

Comment: Title (Formatter: Plain text)

/comment/42

Comment: Title (Formatter: Comment Permalink)

/comment/42#comment-42

Comment: Link to Comment

/comment/42

Is there a way to output anchors in the /node/ space? The solution doesn’t need to support comment pagination (a node will never reach the limit).


texts: How to 'store' email templates in the site?

texts:
On certain events, defined in code, specific mails are sent to certain users in the site (such as on node_save if some value has changed etc).

The content managers need access to those mail templates in order to be able to change literals.

I've thought about having the mail's body inside the node as a field with a 'dummy' default value, but that seems a bit crude. Is there a better way to have my mail templates stored somewhere in the site and access them from code?


texts: Can PhpStorm autocomplete methods in Drupal::service?

texts:
Are there anyway to get phpStorm to autocomplete \Drupal::service("xxxx")->..

[https://api.drupal.org/api/drupal/core!core.services.yml/8 For complete reference of Drupal8 service 1

For example
Typing .. \Drupal::service("config_factory")->g should show "get" in autocomplete popup list

This would be very handy for services from third-party developer also.


texts:
Once again, I am stuck asking questions on CTools that people have asked a million times before. I have a view that displays a list of custom-developed entities (built with ECK) and each one has a link that should show a Ctools-driven modal.

I looked at a few approaches (namely this) to explore any method to get Drupal to display said modal. I figured that I didn't need all this extra views hook logic to fire the modal -- ideally, if a hook_menu() click is fired, it should open the modal and any contents I send to it (which will be done through additional methods). Right now, it treats the logic as a static route, and returns the results as a page. I also explored using the Ctools Auto Modal module (seen in the example, which reflects current code), which also returns the same results when used as documented.

I'm completely lost here, mostly because of the reach of Ctools and the various conflicting forms of documentation on its use for something simple as a tie in for hook_menu(). The long hours i've been pouring into this project are clearly having a toll on my ability to implement this, does anyone have any insight?

The actual logic is below:

/**
 * Implements hook_menu()
 *
 * The sole item call in hook_menu is driven from a URL that is built
 * Within a view, from rewrite rules. When activated, it should render
 * the new modal window.
 */
function example_menu() {
  $items['selectbook/%'] = array(
    'title' => "Perk Modal",
    'page arguments' => array(1),
    'page callback' => 'example_modal_page',
    'access arguments' => array('view content'),
    'access callback' => TRUE,
    'modal' => TRUE,
  );

  return $items;
}

/**
 * Returns a test modal
 */
function example_modal_page($js = null, $attribute = null) {
  return "Test Modal"; //Right now returns as new page call not as a modal
}


texts: Assigning custom class to nested menu UL elements

texts:
I'm trying to theme my menu to alter the default UL classes. So far I'm working with the following function:

function theme_menu_tree($variables){
  return '
' . $variables['tree'] . '
';
}

This works great but I need to apply a different class to the UL inside a parent item. Right now I get

Item

Link1

Link2

How can I target the second UL to give it a different class using the theme_menu_tree function?


texts:
As I have stated in my last few questions, I have almost zero knowledge on Drupal. I have just been given access to a website and told to make changes. So please bare with me and excuse my ignorance. View the below link:

http://www.ascoworld.com/about-us/our-people/leadership-team

The section with the photos and names/titles seems to be a "view"? I have found the edit page (see screenshot). All I am trying to do is add more people. How would I do this? I can seem to add more fields but that just adds to the existing people and not new ones. Any help would be greatly appreciated.

Thanks!

EDIT: Updated the link to live site. Apologies.


texts: migrate-upgrade does not create migrate_plus yml files

texts:
I am trying to migrate drupal 7 site to drupal 8. I have followed this document - https://drupalize.me/blog/201604/custom-drupal-drupal-migrations-migrate-tools
The only change in my website was I had pre-built Drupal8 website and few other migrations on it. Now when i try to run
drush migrate-upgrade --configure-only --legacy-db-key=drupal_7_mysite

I only get below migrations generated.
Generated migrations
 ---------------------------------------------------
  upgrade_block_content_type
  upgrade_block_content_body_field
  upgrade_block_content_entity_display
  upgrade_block_content_entity_form_display
  upgrade_user_picture_field
  upgrade_d6_upload_field

and on config-export i get only below migrate yml and not anything related to node or term migrations.
migrate_drupal.settings.yml
migrate_plus.migration.upgrade_block_content_body_field.yml
migrate_plus.migration.upgrade_block_content_entity_display.yml
migrate_plus.migration.upgrade_block_content_entity_form_display.yml
migrate_plus.migration.upgrade_block_content_type.yml
migrate_plus.migration.upgrade_d6_upload_field.yml
migrate_plus.migration.upgrade_user_picture_field.yml
migrate_plus.migration_group.default.yml
migrate_plus.migration_group.migrate_drupal_.yml

Anyone has any idea where to look for errors? what's wrong?
Similar settings have worked on my local ddev but nothing seems to be working on development server.
Any pointers on where to look for errors?

migrate_upgrade, migrate_plus, migrate_tools are compatible with Drupal8.9 version that i am using.


texts: How to add my html code so as to design the page generated by a view using drupal 7?

texts: I have created a view with a page and a block. Also i have created a new content type by creating a new node--news_page.tpl.php file and a page--news.tpl.php file so as to display my block there. What am i trying to do is to edit the way news are displayed. To accomplish that i need to add my html code to the page the view created. How do i do that using drupal 7 and views3 module?


texts:
i want to share link of post in social media i find module addtoAny and module social media for sharing poste butI didn't find to share post to slack.

Any help?


texts:
I have node creation form in a popup dialog box. I decided to give it a try using ctools modal window. But I seem to be getting errors when I upload an image into a image field after using browse to select it.

Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'node_form' was given in drupal_retrieve_form() (line 795 of /var/www/html/test/includes/form.inc).
Notice: Undefined index: #node in comment_form_node_form_alter() (line 1193 of /var/www/html/test/modules/comment/comment.module).
Notice: Trying to get property of non-object in comment_form_node_form_alter() (line 1210 of /var/www/html/test/modules/comment/comment.module).
Notice: Undefined index: #node in menu_form_node_form_alter() (line 629 of /var/www/html/test/modules/menu/menu.module).
Notice: Trying to get property of non-object in menu_form_node_form_alter() (line 629 of /var/www/html/test/modules/menu/menu.module).
Notice: Undefined index: #node in menu_form_node_form_alter() (line 630 of /var/www/html/test/modules/menu/menu.module).
Notice: Trying to get property of non-object in menu_form_node_form_alter() (line 630 of /var/www/html/test/modules/menu/menu.module).
Notice: Undefined index: field_artwork_image in file_ajax_upload() (line 271 of /var/www/html/test/modules/file/file.module).
Notice: Undefined index: #suffix in file_ajax_upload() (line 280 of /var/www/html/test/modules/file/file.module)

Below is my code

function portfolio_cust_node_add_modal_callback($js = FALSE) {
  global $user;

  //If people are not using JS. I just tell them "sorry" it is '2012'
  if (!$js) return "Javascript required";
  ctools_include('node.pages', 'node', '');
  ctools_include('modal');
  ctools_include('ajax');

 // Create a blank node object here.
  $node = (object) array(
    'uid' => $user->uid,
    'name' => (isset($user->name) ? $user->name : ''),
    'type' => 'psuedo_portfolio',
    'language' => LANGUAGE_NONE,
    );

  $form_state = array(
    'title' => t('Add Portfolio'),
    'ajax' => TRUE,
  );
  $form_state['build_info']['args'] = array($node);
  drupal_add_library('system', 'ui.dialog');
  // change this to your type node form
  $output = ctools_modal_form_wrapper('psuedo_portfolio_node_form', $form_state);

  // This means the form has been exectued
  if (!empty($form_state['executed'])) {
    $output = array();
    // Close the modal
    $output[] = ctools_modal_command_dismiss();
  }

  print ajax_render($output);
  exit;

}

I am planning to use colorbox module or some other method which uses a iframe instead of how ctools implements the modal dialog.

Any help will be greatly appreciated.


texts: address field hides if country is changed

texts:
I have used Address field module for storing user address. Also I have used Customer Profile Type UI for adding customer profile. I have added customer profile field in the user page by adding customer profile field in account settings. In the customer profile type I have added address field, name field and etc..
In my case Check box will be available on clicking checkbox an ajax callback happens which renders the customer profile form which has address field and name, for now no problem occurs. In address field all country are available and showing site default county as default one. If user change the country ajax call happens and address field hides. Please help me.


texts:
I'm trying to create some views with drupal 7.53.

When I try to create view, I set title, type of content, sorted by, and then click save and exit.

Ok, now, add view screen remains and I can't do anything.
I uninstalled jquery update module, jquery easing, taxonomy menu field, nicemenus,  superfish, submenutree and libraries. But the problem remains: view doesn't create.

Some other module that conflicts with views module? I don't know what can I do!


texts: Ctools 7.x-1.9 update breaking ajax entity lookup

texts: I am having an issue with ajax entity lookup, i upgraded Ctools to the latest 7.x-1.9 and i now have an issue searching for articles in the entity reference autocomplete field, it seems the ajax entity lookup is broken on autocomplete creating space encoding %2520 instead of %20. I am using the Entity Reference Module ver 7.x-1.1 & Entity Api ver 7.x-1.6. Has anyone experienced this? Could it be related to the issue as described here https://www.drupal.org/drupal-7.39-release-notes but seems its for Entity Reference Autocomplete & Entityqueue and a bit different to my situation?


texts: Making a view with a node reference argument

texts:
I have two content types, Contributor and Articles.  The Articles content type has a node reference field linked to the Contributor, so when someone creates an Article they can select a Contributor to reference.

On the Contributor nodes, I'd like to have a block view that shows Articles linked to that Contributor.  When I make the block view, how do I set up the argument, or is there a better way to do this?


texts:
I tried all solutions from google and i can not figure out how to increase from 2 MB to 70MB.

In WHM i did changes like from screenshots:

On the Drupal site, it went up to 8MB; whatever I tried with .htaccess, settings.php, it won't go more then 8. Adding php.ini to the Drupal root folder throws a fatal error.

I tried changing file upload size on image field to 65 and 75 MB, it gets saved but on node add, it still says 8 MB

How can I change the upload size globally ? I have access to WHM, Cpanel, SSH, FTP, root, whatever. Server is private, dedicated. Many mentioned changing php.ini, but where is it ? On various answers its on various places and i want to change this globally.


texts: I installed the minimal setup when installing Drupal, and I want a boolean field in one of my Content Types. But this is not enabled. I found this Boolean module, but it only has 859 installs (as of 6th Jan, 2014), so I doubt I need to install that. So how can I enable 'Boolean' as one of the field types?


texts: Attaching a custom javascript library to a Drupal module

texts:
I am trying to attach a custom js library to the contact module.
Here is the content of my js/custom.js file:
function myFunc(){
   console.log('hello toto');
}

document.addEventListener('click', myFunc, false);

Here is the content of contact.info.yml:
name: Contact
type: module
description: 'Provides site-wide contact forms and forms to contact individual users.'
package: Core
# version: VERSION
core: 8.x
configure: entity.contact_form.collection

# Information added by Drupal.org packaging script on 2020-10-07
version: '8.9.7'
project: 'drupal'
datestamp: 1602100551
libraries:
  - contact/custom

and contact.libraries.yml:
custom:
  version: 1.x
  js:
    js/custom.js: {}

However, the custom.js library is not listed in js files when I open the contact page...
Can someone please help?


texts:
I have a content type where users can upload pictures on. Now during the creation of the page, I upload with the widget from the media module. During that tume a square_thumbnail is made. I also have a view that generates a list of such contenttypes where the images have a different style. If I browse to that view none of the images are displayed. What I get is a file not found box ans the source file is supposed to be the home page. I Then go to views and on to the edit the specific view. If I press preview the view then all of a sudden all style image files are generated. So writing permissions should be fine. If I then watch the page with the view all is normal.

Does anybody know what is going on here? Also in the media module I i just upload a file under find content >> media the file is uploaded and an entry appears for that file but no thumbnail.

I have no idea what is happening, thoughts??


texts: ordering profile 2 module profile type tabs

texts:
i am using profile2 module, i create some profile types, but in profile section in admin/structure/profiles   i can't ordering them,is this profile default or this is only my problem?
i means if i add another profile type it just come below of anothers and any feature to ordering them

can i ordering them in form_alter?

function hook_form_alter($form,$form_state){
   change order of theme here ??? how
 }


texts: How to test AJAX Callback with simpletest on Drupal 6

texts:
I know there is drupalPostAJAX() available on Drupal 7 to do this, but I want to use it on Drupal 6.
So I found on this link : http://tiger-fish.com/blog/drupal-6-posting-ajax-callbacks-simpletest a way that should normally make it to work, but no success.

Or maybe I'm not using it as it does.

First of all, I'm using drupalGet() to go on the URL, then I've only one textfield whose send the value (name_search) to the callback by clicking on a "Search" button.
How can I check now, the result return by the callback that's displaying via AJAX ?


texts: Views node author relationships with profile2 owner

texts:
I have a multi user site, with Profile2 enabled. And I've set up a views block which is only displayed on the Profile2 page, and is supposed to list content/nodes authored by the Profile2 page owner.

Now I've made a similar block for the user-page, which works perfectly, using the Content:Author relationship and a Content:Author UID(providing ID from URL as the default value) contextual filer.

But I just can't figure out which relationship(s) and contextual filter to use for the Profile2 page. Now I'm completely lost and googly eyed from trying random combinations.

Am I doing something wrong, or is it just not possible to filter the Author ID from the Profile ID(i.e does https://drupal.org/node/1834920 have something to do with my issue?)? Any hints or suggestions would be greatly appreciated!

Cheers,

Matt


texts: How am I meant to display different elements on different pages?

texts:
I'm coming to Drupal from more conventional MVC frameworks (Laravel, CakePHP, etc.)

In those frameworks, if I want a specific element (say, a form) to appear only on specific pages, then I basically do this:

First, I register a route which maps a URL pattern (e.g., /path/to/form/page) to a PHP controller method (e.g., FormController::display().
Then, from FormController::display(), I return a view which includes the HTML for that form.

Things seem to be very different in Drupal, and it's really confusing me. I think I've figured out how this works in Drupal, maybe – but it's so bizarre (compared to what I'm used to) that part of me thinks it can't possibly be right.

So: can you please confirm (or deny) the following?

In Drupal, I should add all blocks that will ever appear in a particular region (on any URL) to that region (on the Structure > Block Layout page).

I should then configure the Visibility > Pages tab of each block to control which URL(s) it should appear on.

So, for a large site, the "Content" section of my Block Layout page could potentially include dozens of blocks. And it would therefore be misleading to think of the Block Layout view as a preview version of any given page on my site. It's just a listing of which blocks might appear in a region on any given page, depending on how the block placements are configured.

Is that basically right?


texts: How to display visitor's country flag depending on the visitor's IP address?

texts: How can I display Visitor's country name and flag and depending on his IP address in a block?


texts: How can I use TwigExtension from an existing symfony bundle?

texts:
UPDATED

Context

I'm using Symfony Webpack Encore to take care of all the JS and CSS postprocessing, transpiling and so on...

There are different ways to implement webpack, even a module, Webpack bundler but Encore is really amazing.

I installed it via Yarn:  yarn add @symfony/webpack-encore --dev, it's working quite well, and smoothy integrates with theme libraries definitions.

What I'd like to solve

Encore ships with a function, splitEntryChunks() that analyzes files and split them into additional files to avoid duplication, assets big size...

Then in a Symfony app., you simply inject the build output in your templates with a couple of Twig extensions from WebpackEncoreBundle, whichever number of files, e.g

for CSS :{{ encore_entry_link_tags('app') }}
for JS : {{ encore_entry_script_tags('app') }}

If you don't use these Twig functions, you won't know how many files or even their names to link in the templates, so you unlikely will use splitEntryChunks().

This is why I'd like to use these Twig extensions in my Drupal templates.

What I've done so far

I added symfony/webpack-encore-bundle with composer (until then, only the JS part was installed with yarn), created a module and declared the class implementing the Twig extensions as a service.

I also had to take care of some services used in that class. mymodule.services.yml :

services:
  webpack.encore.twig.provider:
    class: Symfony\WebpackEncoreBundle\Twig\EntryFilesTwigExtension
    arguments:
      ['@service_container']
    tags:
      - { name: twig.extension }
  webpack_encore.tag_renderer:
    class: Symfony\WebpackEncoreBundle\Asset\TagRenderer
    tags:
      - { name: kernel.reset}
    arguments:
      ['@webpack_encore.entrypoint_lookup_collection', '@assets.packages']
  assets.packages:
    class: Symfony\Component\Asset\Packages
  webpack_encore.entrypoint_lookup_collection:
    class: Symfony\WebpackEncoreBundle\Asset\EntrypointLookupCollection
    arguments:
      ['@service_container']

At this point the twig extensions are implemented ! Yooooo....but I began to run in Webpack config issues, such as :

  The build _default is not configured in Symfony\WebpackEncoreBundle\Asset\EntrypointLookupCollection->getEntrypointLookup().

So I began to write a class to address these issues... but before diving in a debug session, I'm wondering if the whole approach makes sense.

In a nutshell, is there a canonical and straightforward way to reuse Symfony Bundles in Drupal 8 ?

PS. I 've read that @Kevin's answer but was not inspired enough to follow these guide lines.


texts: How to have View output is same as node output

texts:
I have a content type called poem and a View page that has path like poem/% too. There is a View page for listing the poems called /poems. The poems page will list all the poem titles linked the actual poem
   (eg: "a href="poem/1">What a world ).

I have a block in the poem view to show all the poems written by the poet.
My problem here is when I go to the node by /node/1, I can see the block that list all the poems written by the poet who wrote the node/1 but when I go like /poem/1 I am not seeing the block that list the poems. The node/1 view has bold header of the title but that's missing in my /poem/1 too.

Please help me how to make poem/1 to have the same view as the /node/1.

/poems -> this will list all the poem titles in site, title link would be
/poem/1 instead of node/1

/poem/1 -> display poem content + it should display all the titles of the poem written by the author (/poem/1)

poem list view

poem view

node view of the same poem

poem view setup


texts:
In my website have two types people login one is designer another is reader, i want people come to login my website by role. Mean designer go to design login form to login. Reader go to reader login form to login. my question is:

how to show two login forms in same page?
how to check the role when the visiter login at the same time in login form?
is it any module i can use or i need do something customize the user module and how    customize?

Plz help!


texts:
After a silly feeling with drush make and github I found out that all the .git folders (used by git to record history, config, origin location etc ) were removed by drush make and I have heard about this before but didn't come across myself as I was not maintaining the make files.

Specifically drush make removes the .git folder and u can see that if u run it with --debug option

Executing: rm -rf '/tmp/drush_make_tmp_1305733094/__git__/__build__/.git'

In my make file I am fetching 4 things from git repo because I wish to track development on them, 2 of them are my custom components ( 1 custom module and 1 feature which records all the config) and the other drupal core and media module due to high volume of fixes they receive. The whole purpose seems defeated if I can't have respective .git folders but I am also sure there is a way as others are using drush make with git but couldn't find in my quick search.

Thanks for your time!


texts: In Drupal 7, is it possible to programmatically change the widget type (selection list/ autocomplete text field) of a node reference field?


texts:
I am using Features that includes several basic site features such as the main menu and another custom navigation menu. Both are two level menus.  I have included the menus in the Feature, but when I select the menu links, only a few of the menu link items are included in the selection list.  The balance are missing.

What I have done:

I have searched for other issues on Drupal.org, but not found a similar one.
I have also examined the links and cannot find a difference between those that are included and those that are not.
I have flushed the menu cache.

Has anyone else seen anything like this or have any insights as to how I might fix this?


texts: Conflict between package requirements when updating to Drupal 8.4

texts:
When running composer update, I get the following error:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Can only install one of: symfony/yaml[3.2.x-dev, 2.8.x-dev].
    - Can only install one of: symfony/yaml[v2.8.0, 3.2.x-dev].
    - Can only install one of: symfony/yaml[v2.8.0-BETA1, 3.2.x-dev].
    - Can only install one of: symfony/yaml[v2.8.1, 3.2.x-dev].
    - Can only install one of: symfony/yaml[v2.8.10, 3.2.x-dev].
    - Can only install one of: symfony/yaml[v2.8.11, 3.2.x-dev].
    - Can only install one of: symfony/yaml[v2.8.12, 3.2.x-dev].
    - Can only install one of: symfony/yaml[v2.8.13, 3.2.x-dev].
    - Can only install one of: symfony/yaml[v2.8.14, 3.2.x-dev].
    - Can only install one of: symfony/yaml[v2.8.15, 3.2.x-dev].
    - Can only install one of: symfony/yaml[v2.8.16, 3.2.x-dev].
    - Can only install one of: symfony/yaml[v2.8.17, 3.2.x-dev].
    - Can only install one of: symfony/yaml[v2.8.18, 3.2.x-dev].
    - Can only install one of: symfony/yaml[v2.8.19, 3.2.x-dev].
    - Can only install one of: symfony/yaml[v2.8.2, 3.2.x-dev].
    - Can only install one of: symfony/yaml[v2.8.20, 3.2.x-dev].
    - Can only install one of: symfony/yaml[v2.8.21, 3.2.x-dev].
    - Can only install one of: symfony/yaml[v2.8.22, 3.2.x-dev].
    - Can only install one of: symfony/yaml[v2.8.23, 3.2.x-dev].
    - Can only install one of: symfony/yaml[v2.8.24, 3.2.x-dev].
    - Can only install one of: symfony/yaml[v2.8.25, 3.2.x-dev].
    - Can only install one of: symfony/yaml[v2.8.26, 3.2.x-dev].
    - Can only install one of: symfony/yaml[v2.8.27, 3.2.x-dev].
    - Can only install one of: symfony/yaml[v2.8.28, 3.2.x-dev].
    - Can only install one of: symfony/yaml[v2.8.3, 3.2.x-dev].
    - Can only install one of: symfony/yaml[v2.8.4, 3.2.x-dev].
    - Can only install one of: symfony/yaml[v2.8.5, 3.2.x-dev].
    - Can only install one of: symfony/yaml[v2.8.6, 3.2.x-dev].
    - Can only install one of: symfony/yaml[v2.8.7, 3.2.x-dev].
    - Can only install one of: symfony/yaml[v2.8.8, 3.2.x-dev].
    - Can only install one of: symfony/yaml[v2.8.9, 3.2.x-dev].
    - Can only install one of: symfony/yaml[3.2.x-dev, v2.8.28].
    - drupal/core 8.4.0 requires symfony/yaml ~3.2.8 -> satisfiable by symfony/yaml[3.2.x-dev].
    - Installation request for drupal/core 8.4.0 -> satisfiable by drupal/core[8.4.0].
    - Installation request for symfony/yaml ~2.8 -> satisfiable by symfony/yaml[2.8.x-dev, v2.8.0, v2.8.0-BETA1, v2.8.1, v2.8.10, v2.8.11, v2.8.12, v2.8.13, v2.8.14, v2.8.15, v2.8.16, v2.8.17, v2.8.18, v2.8.19, v2.8.2, v2.8.20, v2.8.21, v2.8.22, v2.8.23, v2.8.24, v2.8.25, v2.8.26, v2.8.27, v2.8.28, v2.8.3, v2.8.4, v2.8.5, v2.8.6, v2.8.7, v2.8.8, v2.8.9].

I've seen a few explanations for similar errors, but I can't figure out how to fix it. I assume it has something to do with incompatibilities between yaml versions. How do I go about solving this?


texts: Disqus not showing on panel page only (panel set as homepage)

texts:
Version Disqus 7.x-1.12
Drupal 7.38
Disqus is only not showing on my panel page. On all the other pages, Disqus is shown. It has shown before on the same panel. I wish I knew all the things I did between the last time it appeared and when I noticed, but I don't.

Things I tried to no avail:

in the configuration settings (admin/config/services/disqus)

I tried adding the block into a region
* Visiblity-    All node types selected; Location: Block
* Default options- All node types selected
* Behaviour- Localisation support: unchecked; Inherit User Credentials: checked
* Advanced- User Access Token: correct value; Public Key: correct value: Secret Key: correct value;
Visibility also set it to content area and weight tried 0, 50, 100, -100

Drupal Issue 1159690:

Doesn't correlate entirely to my issue because the HTML seems to be there (and not with me), but I suppose it was worth trying some ideas still.

Comment #9 insert <?php
print render($content['disqus']);
?> into template

Comment #60 suggest to simply hit save again on said configuration page and somehow that would be all it took.

Drupal issue 928354

About panels integration. Patch at comment #17 no worky.

panel config:

Tried inserting the disQus block in every possible region of my Panel to no avail.

I also tried this (as mentioned in above issue  )

  #
  in /admin/settings/disqus underneath the Visibility section, choose the Block option in the Location dropdown menu.

  Then you just select the "Disqus Comments" block from within the panels interface under the Miscellaneous tab.

On my panel page, when I do a dpm() of $node inside of the node.tpl.php file, there are 2 node objects in my Krumo. In each object there actually is an array for Diqus. This makes sense, because it is Disqus applied to the nodes inside of the panel. These comments don't show either though, but I don't want them to of course. I want 1 Disqus applied to my panel obviously instead.

Blocks configuration

I put the Disqus comments block in different regions of my theme, still same problem: showing up in other regions

Tried activating a different theme, same problem: Disqus shows on every page except the panel.

Updated the module to 7.x-1.12+5-dev, flushed cashes. Nothing changed.


texts: How can I change the Add to Cart button text on specific product forms?

texts: What is the easiest way to change the Add to cart form button text to something custom? I want to change the text only on certain product types. How should I approach this?


texts: Pop-up calendar option does not display when I add Date field in webform

texts:
I am using Date and Calendar module. When I add a component to webform, I selected the Date field > click Add. But I do not see the Pop-up calendar option. However, when I add a content type (structure > Add content > I see the Pop-up calendar option display for the date field).

How I can display the pop-up calendar option when I add Date component to webform?


texts: JSON:API resources error: "This resource attempted to serve data that contains unsupported resource types."

texts:
I'm trying to make a custom JSON:API resource for flaggings using the JSON:API Resources module.
Right now, I simply want to return all the flaggings of a given bundle with an EntityQuery.  (Later, I will customize the EntityQuery, which is why I am need to go beyond what JSON:API provides by default.)
My code is based on the module's example code.
MYMODULE/src/Resource/MyQueue.php
/**
 * Processes a request for a collection containing a user's article nodes.
 *
 * @internal
 */
class MyQueue extends EntityQueryResourceBase {

  /**
   * Process the resource request.
   *
   * Code example:
   * https://git.drupalcode.org/project/jsonapi_resources/tree/8.x-1.x/tests/modules/jsonapi_resources_test/src/Resource.
   *
   * @param \Symfony\Component\HttpFoundation\Request $request
   *   The request.
   *
   * @return \Drupal\jsonapi\ResourceResponse
   *   The response.
   *
   * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
   * @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
   */
  public function process(Request $request): ResourceResponse {

    $cacheability = new CacheableMetadata();

    $entity_type_id = 'flagging';
    $entity_type_bundle = 'MY_FLAGGING_TYPE';
    $entity_type = $this->entityTypeManager->getDefinition($entity_type_id);
    $entity_query = $this->getEntityQuery($entity_type_id)
      ->condition($entity_type->getKey('bundle'), $entity_type_bundle);

    $paginator = $this->getPaginatorForRequest($request);
    $paginator->applyToQuery($entity_query, $cacheability);

    $data = $this->loadResourceObjectDataFromEntityQuery($entity_query, $cacheability);

    $pagination_links = $paginator->getPaginationLinks($entity_query, $cacheability, TRUE);

    $response = $this->createJsonapiResponse($data, $request, 200, [], $pagination_links);
    $response->addCacheableDependency($cacheability);

    return $response;
  }

}

With this code, I'm getting the following error:

LogicException: This resource attempted to serve data that contains
unsupported resource types.

I don't understand why I'm getting this error, or what it means.

If I set $entity_type_id to node and $entity_type_bundle to page, everything works as expected.
If I set the $entity_type_id to 'custom_content_type`, one of the content types I configured in the admin UI, it doesn't work; I get the same error.
I tried to set $entity_type_bundle to all three flagging bundles on my site; none of them work.
The $entity_query is correct for the flaggings.  I can do $entity_query->count->execute() and I get the correct count.
I am logged in as an administrator with all permissions.
I can access the jsonapi in my browser as an admin at /jsonapi/flagging/MY_FLAGGING_TYPE and I see the flaggings as I expect.


texts: How do I disable a single option from select

texts:
I have used a taxonomy entity reference to fill the values of a select form field. Based on the user roles, I want to limit the options between Submitted, Reviewed, Accepted, and Rejected.

I have used a content type to submit ideas. The field idea status is disabled for a subscriber role and available for moderator role and approver role. I want the Moderator to get the status Reviewed and Rejected. Approver should see Accepted and Rejected status.

How can I achieve this?


texts:
I've programmatically created some quicktabs in Drupal 7, however I require html tags within the title.

For e.g:

    $tabs_project['backers'] = array(
        'title' => t('Backers').'strong'.$backers_total.'strong',
        'contents' => 'backer information..',
        'weight' => 2,
    );

But this prints out the strong tags too.. Any ideas? (couldn't work out how to put the correct html tags in the pre tags, so left it as 'strong')

Cheers in advance,


texts: Webform causing Run-time exception error

texts:
I'm getting a runtime error (see below) on a local copy of my production website that I cloned from the cloud. It is related to Webform. I'm not sure what is causing this issue, it is preventing me from running drush commands or viewing any other pages. Has anyone else had this issue? I'm on drupal 8.5.

The website encountered an unexpected error. Please try again later.RuntimeException: Unable to determine class for field type 'webform' found in the 'field.field.node.webform.webform' configuration in Drupal\Core\Field\FieldConfigStorageBase->mapFromStorageRecords() (line 28 of core\lib\Drupal\Core\Field\FieldConfigStorageBase.php).


texts: Check if current node meets conditions, then alter a block's contents?

texts:
In Drupal 7, how would I check whether the current node being viewed meets certain conditions, and then based on that check alter a block's contents?

To give a specific example, I want to check if the current node on my site is a blog post (like http://www.givingwhatwecan.org/blog/2012-10-04/giving-to-charity-%E2%80%93-a-pain-in-the-eye - the conditions here are being tagged with the 'Blog' taxonomy term, or being of type 'story'). If it is, I want to add the class 'active-trail' to the 'Blog' heading in the menu block atop the page.

If need be, I'm happy to use jQuery, though I'd be interested to know the general 'Drupal way' of doing this.


texts: Drupal doesn’t create clean links – checkbox doesn’t do anything

texts:
After migrating my Drupal 7.27 site to a new server, I can’t get Drupal to re-enable Clean URLs.

The .htaccess file works and I can access clean URLS, but Drupal doesn’t create clean links. (For example, /admin/config/search/clean-urls works fine, but the link in Drupal points to /?q=admin/config/search/clean-urls.)

The clean URLs configuration page doesn’t say anything about the test, but offers me the option to enable clean URLs:

When I do that, it says the configuration options have been saved, but the checkbox is still unticked:

I also manually changed the settings.php to include $GLOBALS['conf']['clean_url'] = 1; but that doesn’t help either.

Does anyone have any ideas why this is happening and how I could get Clean URLs to work properly?


texts: Increase maximum amount of characters for entity reference field (tag style)

texts:
I have a Drupal 9 installation running Commerce 2. My products use a taxonomy entity reference field (tag style). There's one products category, where I need to have more references in the tag input field than currently allowed (1024 characters).
I looked it up and found a similar post where someone suggested to write a module to increase the maximum input value like so:
function MODULE_field_widget_form_alter(&$element, &$form_state, $context) {

  if ($context['widget']->getPluginId() == 'entity_reference_autocomplete_tags') {
    if ($element['target_id']['#maxlength'] == 1024) {
      $element['target_id']['#maxlength'] = 3072;
    }
  }
}

So I did that, but it still doesn't let me input more than 1024 characters. Any help would be appreciated. Thank you!


texts: Controlling block page display options programatically

texts:
On block configuration page we can control the display of the block on three factors:
1. All pages except those listed
2. Only the listed pages
3. Pages on which this PHP code returns TRUE (experts only)

how can it be done programatically in my module file?


texts: Create a page to edit all fields from a custom content type

texts:
I have a custom content type that has a custom field called "stock."

I would like to have a single page that shows me all "stock" values in a list, and allows me to change the value. Is this possible?


texts: Update a content type field's allowed values programmatically

texts:
I have a list field in the content type and in the config table , the field storage details saved as follows :

collection:
name: field.storage.node.field_ip_range_sec_zone
data: a:17:{s:4:"uuid";s:36:"9d20e561-e39c-4c11-b100-ff3a29a75267";s:8:"langcode";
                                            s:2:"en";s:6:"status";b:1;s:12:"dependencies";a:1:{s:6:"module";a:3{i:0;s:17:
                                        "field_permissions";i:1;s:4:"node";i:2;s:7:"options";}}s:20:"third_party_settings";
                                    a:1:{s:17:"field_permissions";a:1:{s:15:"permission_type";s:6:"public";}}s:2:"id";
                                s:28:"node.field_ip_range_sec_zone";s:10:"field_name";s:23:"field_ip_range_sec_zone";
                            s:11:"entity_type";s:4:"node";s:4:"type";s:11:"list_string";s:8:"settings";a:2:
                        {s:14:"allowed_values";a:3:{i:0;a:2:{s:5:"value";s:2:"E1";s:5:"label";s:2:"E1";}
                i:1;a:2{s:5:"value";s:2:"C2";s:5:"label";s:2:"C2";}i:2;a:2{s:5:"value";s:2:"D1";s:5:"label";s:2:"D1";}}
            s:23:"allowed_values_function";s:0:"";}s:6:"module";s:7:"options";s:6:"locked";b:0;s:11:
        "cardinality";i:1;s:12:"translatable";b:1;s:7:"indexes";a:0:{}s:22:"persist_with_no_fields";
    b:0;s:14:"custom_storage";b:0;}

As you can see there is Allowed values (E1,C2,D1) , and now i want to add an additional value to the allowed values , How can i do that ?

WHAT I HAVE TRIED

I could get the allowed values using the following :

$entity_type = 'node';
$bundle = 'ip_range';
$field_name = 'field_ip_range_sec_zone';
$ip_sec_zone_storage_values = \Drupal\field\Entity\FieldStorageConfig::loadByName($entity_type, $field_name);

But dont know how to update it , Any idea ??


texts: Change user profile image on profile page to activate colorbox

texts:
This is for Drupal 7.

Currently on the default user profile page, the profile picture just links back to their profile.  I'd like to change this so it opens a colorbox.  Thoughts?

SOLUTION

Add the following to your theme's template.php file.

<?php
function ccom_preprocess_user_picture(&$variables) {
  $variables['user_picture'] = '';
  $original_image = NULL;
  if (variable_get('user_pictures', 0)) {
    $account = $variables['account'];
    if (!empty($account->picture)) {
      // @TODO: Ideally this function would only be passed file objects, but
      // since there's a lot of legacy code that JOINs the {users} table to
      // {node} or {comments} and passes the results into this function if we
      // a numeric value in the picture field we'll assume it's a file id
      // and load it for them. Once we've got user_load_multiple() and
      // comment_load_multiple() functions the user module will be able to load
      // the picture files in mass during the object's load process.
      if (is_numeric($account->picture)) {
        $account->picture = file_load($account->picture);
      }
      if (!empty($account->picture->uri)) {
        $filepath = $account->picture->uri;
      }
    }
    elseif (variable_get('user_picture_default', '')) {
      $filepath = variable_get('user_picture_default', '');
    }
    if (isset($filepath)) {
      $alt = t("@user's picture", array('@user' => format_username($account)));
      // If the image does not have a valid Drupal scheme (for eg. HTTP),
      // don't load image styles.
      if (module_exists('image') && file_valid_uri($filepath) && $style = variable_get('user_picture_style', '')) {
        $variables['user_picture'] = theme('image_style', array('style_name' => $style, 'path' => $filepath, 'alt' => $alt, 'title' => $alt));
        $original_image = image_style_url('large', $filepath);
      }
      else {
        $variables['user_picture'] = theme('image', array('path' => $filepath, 'alt' => $alt, 'title' => $alt));
      }
      if (!empty($account->uid) && user_access('access user profiles')) {
        if (isset($original_image)) {
          $attributes = array(
            'attributes' => array('title' => t('View expanded image.'), 'class' => t('colorbox')),
            'html' => TRUE,
          );
          $variables['user_picture'] = l($variables['user_picture'], "$original_image", $attributes);
        }
        else {
          $attributes = array(
            'attributes' => array('title' => t('View user profile.')),
            'html' => TRUE,
          );
          $variables['user_picture'] = l($variables['user_picture'], "user/$account->uid", $attributes);
        }
      }
    }
  }
}
?>


texts: Is there something like a private FAQ/ask-the-expert?

texts:
I've been looking for a module that allows something like ask the expert with these conditions:

A registered user U uses a form to submit the question. Anonymous users do not have access to this section.
The expert E is notified of the new question by email.
When E answers the question, U is notified by email.
U can only see the questions asked by himself/herself (with their respective answers). No regular user can see the questions asked by other user, or the answers given to other users.
An administrator A can see all the questions and answers at all times.

The modules faq and faq_ask seem like an option, but I can't use the traditional FAQ format, since that format allows all users to see all questions. The module question is not available for Drupal 7.

Is there anything like what I'm describing? If not, is there any way of modifying, for example, the faq module, so permissions will work the way I want?

Thanks in advance!


texts: Why is 1 of 8 menu choices not displaying for anonymous users?

texts:
I have a migrated a Drupal 6 site to Drupal 8, but in order to update the content
I remigrated it. In my Primary link menu I have 8 menus, but
now one of then is shown only to the administrator user.

About Board of  Water  Construction Business Finance Community News &
 us   Directors Supply Facilities   Opps     Invest  Outreach  Publications

Anonymous users see the following.

About Water  Construction Business Finance Community News &
 us   Supply Facilities   Opps     Invest  Outreach  Publications

This is something that was not happening when I did my first migration.

I am using Superfish.

What happened? How can I fix this?


texts: add a search bar on a page and limit it to search only under post titles?

texts:
I wand to add a search bar on a page called "dictionary" and want to limit it to post titles. I mean it should search only texts in posts tiles not the whole posts contents. Please explain me clearly step by step how to do it.

Regards
Ismail


texts:
I have been experimenting with the Webform Alternate UI module for Drupal Webforms. As you would know it requires a few excess modules like options_element, ux element and form builder. The thing is, the webform alternate UI shows up but it does not really work when I attempt to drag and drop the form fields onto it. Its' clearly buggy. And it seems like it has some unfixed issues persistent along with it.

I want to check on stackoverflow with anyone who has played along with the webform Alternate UI and found it to be buggy and has a fix for it?

Thanks much


texts:
I am using bartik theme to develop a website.I need the User menu and search block to be beside the logo and main menu block to be below the logo.
But all the menu and search blocks appear below the logo.How can I move the user menu and search block to right top corner of the page.

Thank you in advance.


texts:
I have a computer product that fits many types of computers.  The product has a brand, and more than one computer model can use the same product.  I want to let users search by product, or click through by brand, or click through by product.

I'm having trouble figuring out how to set this up with Drupal Commerce.  I read up and down on the site, but can't seem to get it.

One brand to many products.
One product to many computer types.
One computer type to many products.

Thanks for any help.


texts: cck field coming as broken handler in views filter

texts: Views is showing borkn handler in filters and field is existing in content type. I have tried clearing caches, removing and adding field again. Any help?


texts: How can I set-up a custom formatter that uses target="_blank"?

texts:
I've installed the Custom Formatters module, as I could not figure out why my View setting was not working for "Rewrite output" -> "Target" -> "_blank"

I need to recreate either the "Generic File" format or the "Rendered File" -> "Link" format.

This is what I've tried but I suppose 'attributes' is not something I can add for the $variables array in theme() -

$output = '';
foreach ($variables['#items'] as $item) {
  $output .= theme('file_link', array(
    'file' => (object) $item,
    'attrs' => '_blank',
    ));
}
return $output;

That formatter code above was found on the CustomFormatters.com site for Generic Image