texts: How to install a text filter for plain_text input format

texts:
The users at my Drupal 7 website discuss a card game in plain_text comments and I'd like to format the hearts and diamonds characters by red color.

Based on the Examples module recommended to me here at "Drupal Answers" site I've added the following code to my custom module sites/default/modules/pref/pref.module:

function pref_block_view($block_name = '') {
       ... this other part of my custom module works well ...
}

function pref_filter_info() {
  $filters['plain_text'] = array(
    'title' => t('Pref filter'),
    'description' => t('Replace the ♠ ♣ ♦ ♥ characters'),
    'process callback' => '_pref_filter_process',
  );
  return $filters;
}

function _pref_filter_process($text, $filter) {
  $text = str_replace('♦', '♦', $text);
  $text = str_replace('♥', '♥', $text);
  return $text;
}

However still nothing is highlighted in comments.

The rest of my custom module works fine (it generates few blocks - for the Flash game and player rating).

How to register my filter for the plain_text please? I suspect that

 $filters['plain_text'] = array( ... );

is a wrong way.


texts:
I am a Drupal newcomer and have been tasked with updating a Drupal site.

The currently installed version is 7.2.1

I have taken a full backup of both SQL and files so I am safe if anything goes wrong.

My question is the upgrade for Drupal a manual one, as in, do I have to download the update and FTP it over?  I am used to Wordpress being a one-click affair!

Also, is there anything I should be aware of?


texts: How to add conditional on Gutenberg's color theme-support?

texts: I've added the Gutenberg theme-support on my custom theme. I want to add conditional based on text color and background color. For example, selecting the black color background will reset the default text color to white and disable the black text option. Is there a solution or documentation about this?


texts: How to mirror product date attribute availability on the availability calendar?

texts:
I would like to mirror the available dates of the current product line item depending on the availability calendar of that specific product. The availability calendar is what the owner/admin of that product will fill up.

Then there is another date field that is on the line item (add to cart) of that product that will allow the customer to choose when to use/get/rent that certain product.

As you can see on the availability calendar, the 19th, 21th, 23rd, 26th, and 28th of Feb are fully booked. I want the same dates on the popup calendar to be disabled.

How can I achieve that?

These are modules I already tried:

Rooms - This is not fit for our website because of the forms/steps we are using.
Commerce Availability - This is exactly what I wanted but it's not working on my end. The date is still bookable on the line item even though my availability calendar is already fully booked. I already followed the instructions and fixed the settings of the module.

I also checked the demo of the Easy Booking, I had to guess which date is not available, which is not also good.

Thank you for the help in advance!


texts: Devel - Theme Developer popup can not be seen on "Manage fields" tab

texts:
I'm using the very useful Theme developer module for theming and element display investigating purposes.
When enabled, it displays a floating "Themer info" checkbox on the bottom left corner of the browser's content area, if you put a tick in this box, a popup window appears where you can get some theming data, like the one you can see here.

OK, I would like to investigate some of the theming data on the "Manage fields" tab of the content type edit forms belonging to CCK. But this is a page where no "Themer info" is getting displayed. Why, and how could I "force" it to be displayed?

Some images to be clear:

editing the "Page" content type, "Edit" tab (/admin/content/node-type/page), here you can see the floating "Themer info" in the left corner

editing the "Page" content type, "Manage fields" tab (/admin/content/node-type/page/fields), there is no floating "Themer info" in the left corner!!

Any ideas, hacks are appreciated. :)
Thanks in advance!


texts: Locking nodes or entities to prevent concurrent editing

texts:
I have not had a need for this, but another (home built PEAR) CMS I support for a client uses locking to prevent two users from being able to edit a piece of content at the same time. It can be irritating but could prevent loss of work.

I suppose if you have multiple site editors it could be invaluable.

Is it necessary? Is the module content lock a viable option?


texts: How to delete Ghost Menu Link in Main Menu?

texts:
I added a menu link in main menu: user/%/notifications/subscription. The menu is never visible except that when a user goes to his subscription page via 'My Account'. The menu link is not available when I try to edit the main menu links. It is not there. This problem surfaced up after I installed Menu Token module. However, I committed the sin before installing the Menu Token] module. I have uninstalled this module.

Additionally, user gets the following error when visiting user/%/notifications/subscription.

  "Notice: Undefined index: localized_options in menu_navigation_links() (line 1858 of /home/carrotjo/public_html/includes/menu.inc)."

After some search on the Internet, I commented out $l = $item['link']['localized_options']; (line 1857 in menu.inc). The error is gone. But the ghost appears in the main menu link.


texts: D8. How can check is a formatter in use?

texts:
I contribute a module that provides additional formatters for the core image and link fields.

To protect the module from uninstall, I need a possibility to check if a providet formatter used on a image or link field.

To do this, I use the hook_system_info_alter() with

$info['required'] = TRUE;
$info['explanation'] = t('Field formatter(s) in use');

Someone has an idea?


texts: In Drupal 7, how to prevent *.php files from being upload to the /files folder when its required to have 777 permissions?

texts: Hi one of the sites im working on just recently got comprised and a bunch of php files got upload somehow or someway into the files folder and started sending out alot of spam. I know during installation they ask for the files folder to be set at 777 permissions, but is there a way to prevent any php scripts from ever running in that directory if they were ever to get uploaded.


texts: Is my web hosting company's "Full Backup" sufficient protection before an update?

texts:
I'm learning how to work my little Drupal site, which is currently hosted on HostGator. It's well past time to update, and I want to make sure I'm safely backing up my site.

HostGator can facilitate "Full Backups" of my files, which they describe thus:

A full backup includes all of the files in your home directory, your MySQL databases, and your email forwarders and filters. You can back up your account to preserve your data, or to move your account to another cPanel server.

Thank in advance, and/or apologies if this is a crap question.


texts: More than one modules implementing the hook_module_implements_alter

texts:
How can I know what module will implement earlier?

I have a module (custom) which implements hook_module_implements_alter and an other module (contrib) which is also implements it. In this case the contrib module is being executed later, overriding my implementation.

So, how can I ensure that my module will be executed later?


texts:
I am creating a custom page with hook_form and using the datatype
'#type' => 'date,

I would like to make that field required.

AND, I want it to initially display blank.

Without #default_value specified, the default is today. How do I, in effect, make the default_value NULL?


texts: How can I tell Guzzle to safely ignore ssl.certificate_authority in Behat testing? (Development server)

texts:
On a sandbox install of Drupal running behat under the Behat Drupal Extension, I'm trying to fun the following feature:

@api
  Scenario: Logged in User
    Given I am logged in as a user with the "administrator" role
    And I am on '/user'
    Then I should see the heading "User"

Inital cURL error

I get this error complaining about the SSL certificate.

cURL error 60: Issuer certificate is invalid. (GuzzleHttp\Exception\RequestException)

My first attempt to ignore fails

This makes sense. This is a sandbox on RHEL 7 where I just activated mod_ssl. In order to try to ignore this, I added the ssl.certificate_authority: false to behat.yml. Since that I now see this...

  No method can handle the ssl.certificate_authority config key
  (InvalidArgumentException)

behat.yml set up

 default:
      suites:
        default:
          contexts:
            - FeatureContext
            - Drupal\DrupalExtension\Context\DrupalContext
            - Drupal\DrupalExtension\Context\MinkContext
      extensions:
        Behat\MinkExtension:
          goutte: ~
          sessions:
            my_session:
              goutte:
                guzzle_parameters:
                  ssl.certificate_authority: false
          selenium2: ~
          base_url: http://localhost
        Drupal\DrupalExtension:
          blackbox: ~
          api_driver: 'drupal'
          drush:
            alias: 'local'
          drupal:
            drupal_root: '/var/www/html'

Update
Based on information from the Github issue queue, I have changed my


texts:
Below is my .module file, when i go to mysite/timeline/nodes there is no display. While what i am planning is to display a timeline . I am new to Drupal (and web development). I have other JS,JSON and PHP file in my module folder too to make the simile timeline script available to the code, if somebody needs to see that please tell. Also i have read that tpl.php provides sometype of solution (i havent read it much so i dont know how it does exactly) but i want to display the regular page theme and put content in the content area when using hook_menu to create a new page.

function similetimeline_menu() {
$modulepath = drupal_get_path('module', 'similetimeline');
drupal_add_js($modulepath . '/similetimeline.js');

$items = array();
$items['timeline/nodes'] = array(
'page callback' => 'similetimeline_callback_nodes',
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
$items['timeline/ratings'] = array(
'page callback' => 'similetimeline_callback_ratings',
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
return $items;
}

function similetimeline_callback_nodes() {
$query = new EntityFieldQuery;

$query->entityCondition('entity_type', 'node')
  ->entityCondition('bundle', 'article')
  ->propertyCondition('status', 1);

$results = $query->execute();
$output = array();
if (isset($results['node'])) {
$nodes = node_load_multiple(array_keys($results['node']));
foreach ($nodes as $nid => $node) {
  $output[$nid] = array(
    'title' => $node->title,
    'timestamp' => $node->created,
    'body' => $node->body[LANGUAGE_NONE][0]['safe_value'],
  );
 }
}
dpm($output);

global $base_path;
$timeline_lib_path = $base_path . libraries_get_path('simile_timeline');

// Set some global js variables that the library is going to need for proper inclusion and funcionality
$timeline_inline_js = "
var Timeline_ajax_url = '$timeline_lib_path/timeline_ajax/simile-ajax-api.js',
     Timeline_urlPrefix = '$timeline_lib_path/timeline_js/',
     Timeline_parameters = 'bundle=true';
";
drupal_add_js($timeline_inline_js, array('type' => 'inline', 'weight' => 10));

// Adding general timeline library
drupal_add_js("$timeline_lib_path/timeline_js/timeline-api.js", array('weight' => 11));

$html = '';
$html .= '

 This page uses Javascript to show you a Timeline. Please enable Javascript in your browser to see the full page. Thank you.';

 print theme('similetimeline', $html);
 return null;
 }


texts:
I've added a node as a block to my home page (using nodesinblock module). I've got it looking basically like I want it to look with the teaser appearing in the block, but I'd like to add a 'read more' link (or button) to the bottom of the block.

Note: I do NOT want this 'read more' link to appear on the full content node, just the block.

Anyone know how to add some html specifically to a block on the home page?


texts:
I am trying to add jQuery to my page (it is not being added by default). The file is adding to the page but after drupal.js causing the error:

SCRIPT5009: 'jQuery' is undefined
drupal.js, line 5 character 1

The code that adds drupal.js to the page in common.inc

...
'misc/drupal.js' => array(
          'data' => 'misc/drupal.js',
          'type' => 'file',
          'scope' => 'header',
          'group' => JS_LIBRARY,
          'every_page' => TRUE,
          'weight' => -1,
          'preprocess' => TRUE,
          'cache' => TRUE,
          'defer' => FALSE,
        ),
...

In my module hook_init I have:

  drupal_add_js('misc/jquery.js', array(
    'group' => JS_LIBRARY,
    'weight' => -20,
    'cache' => TRUE,
  ));

I would think with a lower weight it would load before drupal.js?

The header of the page contains the following scripts:

<script type="text/javascript" src="http://mysite.com/misc/drupal.js?mqdxrf"></script>
<script type="text/javascript" src="http://mysite.com/misc/jquery.js?mqdxrf"></script>
<script type="text/javascript" src="http://mysite.com/misc/jquery.once.js?mqdxrf"></script>
<script type="text/javascript" src="http://mysite.com/sites/default/files/languages/nl_c9aC92_wtuULa79-hTFcGPM53oqk1yKwciOa_Q3yO28.js?mqdxrf"></script>
<script type="text/javascript" src="http://mysite.com/sites/all/modules/lang_dropdown/msdropdown/jquery.dd.js?mqdxrf"></script>
<script type="text/javascript" src="http://mysite.com/sites/all/modules/lang_dropdown/lang_dropdown.js?mqdxrf"></script>
<script type="text/javascript" src="http://mysite.com/sites/all/modules/devel/devel_krumo_path.js?mqdxrf"></script>


texts: What does the code status "build: error" signify for Drush 8?

texts: On the install page for Drush 8, under the section "Drupal Compatibility", the code status is listed as "build: error".  What are the consequences of this, if any?


texts: hook_form_alter isn't being called when node fails validation

texts:
I'm noticing that hook_form_alter isn't being called when a page has errors that display a message from form_set_error.  Changes to my form aren't taking effect, and the error page is effectively broken.

I've tried to output a dpm statement in hook_form_alter, but it isn't appearing on the error page.

Is there a way to get drupal to call the hook and alter the form?


texts: Drupal 8 migrating image from local folder per XML file

texts:
I'm trying on this for two days now and I don't get it. I need some more experienced people to look over my code. This is my first Drupal 8 project, meaning, Drupal 8, Twig, Migration API, Yaml... it's a lot of new stuff for me and I'm still learning.

I need to import data from a XML file. I wrote a custom module and was able to migrate all the XML nodes into D8 nodes, but only text fields and taxonomy terms.

There are also image references in some XML nodes and I know, I have to migrate them first into file entities before referencing them in the nodes. So I wrote a second migrate configuration, but it doesn't work and I'm stranded. I don't find a mistake in my yml file, it's close to this example on GitHub: drupal-migration-example

My source data folder, containing some jpgs and a XML file, is stored inside the public file folder.

Maybe important for my issue: Not every XML node has an image reference. But I think I catch that with plugin: skip_row_if_not_set. I don't know how to debug that.

What I have so far:

id: clio_cover_import
label: Clio-Cover-Import
migration_group: werk_import
# Source
source:
  # XML data parser
  plugin: url
  data_fetcher_plugin: http
  data_parser_plugin: xml
  urls: public://import/werk-import.xml
  item_selector: /Werke/Werk
  fields:
    -
      name: clio_cover
      label: 'Werk-Cover'
      selector: Coverpath
  ids:
    clio_cover:
      type: string
  constants:
    file_source_uri: public://import
    file_dest_uri: 'public://cover_uploads'
# Destination
destination:
  plugin: 'entity:file'
#Mappings
process:
  settings:
     # Check if the "clio_cover" key exists in the "data" array.
     plugin: skip_row_if_not_set
     index: clio_cover
     source: data
     message: "Missed the 'data' key"
  file_source:
    -
      plugin: concat
      delimiter: /
      source:
        - constants/file_source_uri
        - clio_cover
    -
      plugin: urlencode
  file_dest:
    -
      plugin: concat
      delimiter: /
      source:
        - constants/file_dest_uri
        - clio_cover
    -
      plugin: urlencode
  uid:
    plugin: default_value
    default_value: '1'
  filemime:
    plugin: default_value
    default_value: 'image/jpeg'
  status:
    plugin: default_value
    default_value: '1'
  filename: clio_cover
  uri:
    plugin: file_copy
    source:
      - '@file_source'
      - '@file_dest'
# Dependencies
dependencies:
  enforced:
    module:
      - clio_import_modul
migration_dependencies:
  required: {}
  optional: {}

Every help is very appreciated!


texts: How can I effectively copy a production site to a local XAMPP copy?

texts:
I have a working live Drupal 8 website and it's still in its early stages.
I need to start theming the website, so I needed a local copy of it on my Windows PC. I installed XAMPP, copied the website, exported and imported the database and cleared the cache_*, sessions and watchdog tables.

The site is currently working nicely as expected, but I cannot log in as administrator. It keeps rejecting my password to the point that I changed the password from the database using a hashed password, but that didn't work, and now the account is temporarily blocked.

What could I've missed?

N.B. : I'm logging in from a login block on the front page (localhost:1234/Sites/d8dev/).

When I sign in, the failing sign in text appears in a link similar to localhost:1234/Sites/d8dev/node?destination=/Sites/d8dev/node.

Also note that this 'failing sign in' page looks terribly un-styled, like there's no or incomplete CSS styles are applied to it.

What am I missing?


texts: Is Drupal scalable across multiple geographical locations?

texts:
I'm investigating how a Drupal site can be scaled across multiple geographical locations. The primary requirement for this is high availability. The site should be able to run despite some sort of outage on a single location.
The site is a "heavy read, low write" site, meaning that users will never create accounts and edit content. All content is edited by moderators only.
The following two options pop into my mind. I'd be interested in hearing if anyone else have experiences with similar setups - or just general feedback on how viable these options are.
1 WAN-wide cluster
A WAN-wide cluster could be achieved using a database cluster and a storage cluster. However, the immediate implications - as far as I see it - is latency. If we choose to go with a MariaDB/Galera cluster (which is synchronous replication), performance will be very dependent on network latency. For storage, something like GlusterFS (separate storage tier) could solve our needs. However, this again is latency dependent and I'm not so sure replication across an entire WAN is a good idea. The idea of a synchronous cluster (Galera/GlusterFS) is compelling as it removes a few timing issues (replication lag) which you need to take into account otherwise.
The other option for a WAN-wide cluster would be a "regular" master-slave database cluster, where we would have a single master database where all content editing is made. The master database will be located in one location, and the other geographical location(s) will have slave databases only. However, you can never guarantee that some Drupal node not will attempt to write to a database - so all Drupal nodes regardless of location will need to have the possibility to get in touch with the master database to execute write queries. This could be achieved using the AutoSlave module. However, this design makes the other geographical locations dependent on the single master node. If some sort of outage happens here, the master node will no longer be available and all other sites will possibly fail. This defeats the entire idea of high availability. With regards to storage, something simple like lsyncd/csync2 or BitTorrent sync could solve file replication. This would be asynchronous file replication, but I don't think that would be a problem as the site is "heavy read, low write". Only a couple of images a day gets uploaded. Cached JS/CSS and thumbnails would possible be excluded from synchronization, which would put a little more load on all frontends - but that would be a question of testing how much load that would be.
2 Content sharing between locations
I'm not sure how this one could be done, and I'm afraid complexity grows. However, separate - but identical - Drupal installations could be set up at multiple locations. All content editing could be made at one of the sites (master), which would publish content to the other sites. There would be no database or storage dependencies between the sites. However, I'm not sure if this is all that easy to to - especially when content gets complex with multiple fields, media types, images etc.


texts: Will there be any unexpected side effects when I upgrade the Zen theme?

texts:
I have installed the 7.x-5.6 theme and I want to upgrade to the 7.x-6 version. I have created 2 subthemes from it that I hardly use, and I hardly use the Zen theme itself - it is supposed to be base theme,not actually used in any case.

Is it okay for me just to disable and delete the base theme and the derived themes and install the 7.x-6.4 as though the previous ones were never installed in the first place?

PS. Are there any hidden downsides to uninstalling themes, like some stray database tables etc?


texts: MailChimp connects through live site, but not through dev site

texts:
This is using the latest MailChimp Drupal 6 version 6.x-2.6

On the Live site MailChimp connects correctly and gives me the lists on my client's account.

But on my Dev site (WAMP server) it fails to connect and claims I have no valid lists. This is an issue because I need to do some custom blocks to link through to MailChimp and obviously I can't do that on the Live site.

Any ideas as to what might cause this effect?


texts: Change the text on the message which is displayed after the user registration

texts:
I am looking for a way to replace the text in this message which appears on the website after a new account if created.

  Thank you for applying for an account. Your account is currently
  pending approval by the site administrator. In the meantime, a welcome
  message with further instructions has been sent to your e-mail
  address.

Has anyone managed to change this successfully?

Thanks!
Anton.


texts: Include content created through InDesign/RoboHelp

texts:
Is there a way to display content under a Drupal site/url that is not managed by Drupal?

Specifically, we have a large manual (1700 pages) that is managed with Adobe InDesign which is used to create a printed version, one large PDF version, PDF versions of each chapter, and also an HTML version of the manual via RoboHelp. Because of the printing requirements, this is not content that we plan to migrate into Drupal (but we still need to display it on/through the site).

Example: Here is the page for the manual. You can see links for the Complete PDF and individual PDF chapters (which we would probably manage as Media - TBD). The question revolves around the HTML version of the manual. As you can see, at this point we have pretty much jumped out of the container of the hosting site (SharePoint), and are now displaying just the pure, rendered HTML that was generated out of InDesign/RoboHelp.

The content is updated annually and we have requirements to archive each version so that it is still accessible. Our current process makes it fairly easy because of the way that the /Manuals_HTML1 folder is excluded from SharePoint so we just make a copy of the content and give it a new folder based on the year.

So, it doesn't appear to make sense to include this as actual content in Drupal. It feels like it would be some sort of exclusion within Drupal that essentially sends it outside of Drupal. Maybe a mod_rewrite solution?

Brand new to Drupal and currently in a week-long training. Definitely learning tons about how to handle the rest of the site, but this one is an open item.


texts: Add a having condition that makes use of COUNT

texts:
I currently have a query that compiles to

SELECT n.nid AS nid, field_data_field_date.field_date_value AS incident_date, field_data_field_tweeted_date.field_tweeted_date_value AS tweeted_date, n.nid AS n_nid, (SELECT source.field_source_value AS field_source_value
FROM
field_data_field_sources sources
left JOIN field_data_field_source source ON source.entity_id = field_sources_value
WHERE  (sources.entity_id = n.nid)
ORDER BY sources.delta DESC
LIMIT 1 OFFSET 0) AS most_recent_source
FROM
node n
left JOIN field_data_field_incident_type incidenttype ON incidenttype.entity_id = n.nid
left JOIN field_data_field_date field_data_field_date ON field_data_field_date.entity_id = n.nid
left JOIN field_data_field_tweeted_date field_data_field_tweeted_date ON field_data_field_tweeted_date.entity_id = n.nid
WHERE  (n.type = 'incident') AND (n.status = 1) AND( (incidenttype.field_incident_type_tid IN  (9,25)) )
GROUP BY n.nid
ORDER BY field_data_field_date.field_date_value DESC

I want to add

HAVING COUNT(DISTINCT incidenttype.field_incident_type_tid) = 2

And I can get it to work in the query when I manually create it in my SQL gui, but I can't seem to add it to the query in drupal properly.

I added

$query->addExpression('HAVING COUNT(DISTINCT incidenttype.field_incident_type_tid) = 2');

But that didn't add it how I wanted to the query. The query compiled to

SELECT n.nid AS nid, HAVING COUNT(DISTINCT incidenttype.field_incident_type_tid) = 2
AS expression FROM {node} n left JOIN {field_data_field_incident_type} incidenttype ON incidenttype.entity_id = n.nid
left JOIN {field_data_field_date} field_data_field_date ON field_data_field_date.entity_id = n.nid
WHERE (n.type = :db_condition_placeholder_0) AND (n.status = :db_condition_placeholder_1) AND (n.created < :db_condition_placeholder_2) AND( (incidenttype.field_incident_type_tid
IN (:db_condition_placeholder_3, :db_condition_placeholder_4)) )
GROUP BY n.nid ORDER BY field_data_field_date.field_date_value

I'd like to have it between GROUP BY and ORDER BY since that seems to be what worked in the query I manually wrote. Also it added 'AS expression' to the end of it. Is there a way I can specifically add 'HAVING COUNT(DISTINCT incidenttype.field_incident_type_tid) = 2'? Or should I be going about it a different way?


texts:
I've been searching for this for a while, but most of the articles I have found are from YEARS ago, so I wanted to jump in here and see if any of you lovely people have an idea... :)
I am creating a webform for a customer that has a fieldset that needs to be applied to different sections within the form, but with all the same fields within that fieldset.
Is there a way to actually duplicate/clone a fieldset within a webform in Drupal 8?
I'm using:

Drupal 8.9.1
Webform Version: 8.x-5.19

Any help would be very much appreciated!
Thank You!
Nicole


texts:
I've using default translate module. I enabled 2 languages, setted translation in nodetype. So now if i will setup view like this:

It will display only translated nodes. If I set all languages, it will show all nodes, but with duplicates (first and second languages).

How to set in this way: display translated nodes, but if some are not translated, display untranslated?


texts: how to create tabbed blocks for recent comment and recent content?

texts: i want to create a tabbed block with two tabs . One for showing recent content and one for showing recent comments .. how can it be done in drupal 7 using only the modules ??


texts: Combine views sort criteria in exposed form

texts:
Drupal 7, views 3.6.

I have a view with 2 sort criteria: date and category. The sort is exposed in a form block.
Currently the user only has the choice to select 1 sort criteria, ie: sort by date or sort by category.

Is there a way to have the combination of these 2 criteria exposed, ie: sort by date asc, and by category desc ?

Thanks for your input,
Jerome


texts: Error: Class 'Drupal' not found in bootstrap.inc

texts:
Please tell me what I'm doing wrong. I'm unable to run drush, see error below:

[~/public_html/d8]# drush -d status
Bootstrap to phase 0. [0.01 sec, 1.86 MB]                            [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drush() [0.01 sec, 1.98 MB] [bootstrap]
Cache HIT cid:                                                       [debug]
6.0-rc4-commandfiles-0-6046c80192c5b97fbcd88f24c7e529ed [0.02 sec, 1.99 MB]
Bootstrap to phase 0. [0.09 sec, 5.27 MB]                            [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.14 sec, 5.28 MB] [bootstrap]
Initialized Drupal  root directory at /home3/public_html/d8    [notice] [0.15 sec, 5.39 MB]
Drush command terminated abnormally due to an unrecoverable error.   [error]
Error: Class 'Drupal' not found in /home3/public_html/d8/core/includes/bootstrap.inc, line 164  [0.15 sec, 5.4 MB]

I'm using:

Drush Version   :  6.0-rc4
drupal 8.0.0-beta7
PHP 5.4.38
MySQL 5.5.42-37.1


texts: No results behavior in Views not working when referencing another field after cache clear

texts:
My Setup:

I am using Drupal 7.41 and Views / Views UI 3.11.

I have a taxonomy named sermon series that includes a field called series image.
I have a content type called sermons that has an image called sermon image and a term reference to the sermon series taxonomy.
Lastly, I have a View called sermons that:

pulls in the most recent 1 node from the content type sermons
has a relationship to the taxonomy sermon series
has the first field in the fields list as the sermon series image (from taxonomy) and is set to "hide from display". The replacement pattern token for this field is [field_sermon_image_2]
has the second field in the fields list as the sermon image (from content type) and is set to show in the display.

this field has a no results behavior set to the token [field_sermon_image_2]

Expected Behavior:

If the most recent node has an image associated with it, that image will show. If there is no image associated with the node, it will show the image associated with the taxonomy sermon series.

Actual Behavior

When I create a node with the sermon image filled out, everything works as expected and the view shows the sermon image associated with the Node shows.

When I create a node without a sermon image filled out, the view correctly shows the sermon series image associated with the taxonomy sermon series.

Here's where it gets weird. If I create a node without a sermon image filled out, see the view correctly show the sermon series image from the taxonomy, then either clear cache or wait until cache expires, no image shows up at all. I know the fallback is working correctly as even the [field_sermon_image_2] has a no results behavior fallback to a generic image and that's what always shows up.

Through some testing, I found that unpublishing the node, viewing the view, then re-publishing the node will bring the correct image back (at least until the next cache flush).

I'm not sure where to look for this odd behavior. It seems like I have everything setup correctly in my view as I can get the correct images to show up, I just can't get them to show up consistently.

Any advice you can give would be appreciated. Thanks!


texts: Composer update Drupal core, 8.5.1 to 8.5.2 Nothing to Install

texts:
I am running Drupal 8.5.1, with php 7.2 and a new security update 8.5.2 was just released. Per the documentation, I should be able to update Drupal core with composer.

I ran the following command:

composer update drupal/core --with-dependencies

I keep getting :

  Nothing to install or update
  Generating autoload files
  Drupal\Core\Composer\Composer::preAutoloadDump
  Drupal\Core\Composer\Composer::ensureHtaccess

Has anyone have any luck updating a drupal site with composer? I usually update my Drupal sites manually but this is getting tiring. I do not trust drush for my updates.


texts: add text before block is being displayed in region content

texts: I have a block that I want to display in my Content region which works fine but the block is always fix aligned in the top left corner (float: left property). How can I set it so, that my content displays above the block in my region?


texts:
I transferred my files via FTP and database to a hosting service. I edited two files, settings.php and sites/default/settings.php whose content was originally the following.

$databases = array (
  'default' =>
  array (
    'default' =>
    array (
      'database' => 'db',
      'username' => 'loginname',
      'password' => 'passwd',
      'host' => 'localhost',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',
    ),
  ),
);

I changed the database name, username, password and host (to yes.domainname.com) in both files.

There is probably something wrong because I get this warning.

  Warning: Cannot modify header information - headers already sent by (output started at /web/www/yes.domainname.com/sites/default/settings.php:1) in drupal_send_headers() (line 1044 of /web/www/yes.domainname.com/includes/bootstrap.inc).

Do you know what is wrong?


texts: Anyway to disable minification (make line breaks) in the source view of CKEditor WYSIWYG

texts:
My question is different from one I've seen answered quite a bit here and elsewhere. My line breaks are showing up in WYSIWYG and the rendered content just fine. However, I was wondering if there is a way to make CKEditor/WYSIWYG preserve line breaks when I view the code as well. I sometimes need to edit code in the HTML, and it's a mild inconvenience to have to sift through minified code to find stuff.

Any help is appreciated. Thanks.


texts: Reference to another database as a prefix

texts:
I have a problem referencing another database as a prefix in my settings.php file.I have a master-site[mysite.local] and a slave [sub.local].Both of them are having separate database.I need to check the users table of the master-site as well as the users table of the slave site ,when a user tries to authenticate to the slave which is sub.local.I tried adding the following in the settings.php file of the slave

$databases = array (
  'default' =>
  array (
    'default' =>
    array (
      'database' => 'sub_drupal', //Database for the slave site
      'username' => 'root',
      'password' => '',
      'host' => 'localhost',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => array(
                'default'   => 'sub_drupal.',
                'users'     => 'study.', //parent database
                'sessions'  => 'study.',
                'role'      => 'study.',
                'authmap'   => 'study.',
                'users_roles'   => 'study.',
            ),
    ),
  ),
);

But now it authenticates users only on the parent database.Is it not possible to authenticate users present in the slave database sub_drupal and also in the parent database study.Hope someone could help me with this.Thanks


texts: Use dropdown in views exposed filter on text fields with node->title?

texts:
I followed this link to transform my exposed filter from textbox to  dropdown list.

Use dropdown in views exposed filter on text fields with entity not node?

I make it work with a custom textfield.

I have problem to use the module with node title.

My code till now is:

<?php

function views_dropdown_form_views_exposed_form_alter(&$form, &$form_state) {
global $user;

// Only alter forms with the necessary field
if (isset($form['title'])) {

// Build a query to get all node ids having the specified field
$query = new EntityFieldQuery();

$results = $query->entityCondition('entity_type', 'node')
                  ->entityCondition('bundle', 'rapporto_di_lavoro')
                  ->propertyCondition('uid', $user->uid)
                  ->propertyCondition('title', 'NULL', '!=')
                  ->execute();

// Attach the field values to the nodes
$ids = array_keys($results['node']);
print_r($ids);
print('
');
// Add a default so the filter is optional
$options = array('' => '<select>');

// Buld the options array based on the query results, overwriting duplicate entries
$query = db_select('node', 'n')
            ->fields('n', array('title'))
            ->condition('n.nid', $ids, 'IN');
$options = $query->execute()->fetchAll();

$op = json_decode(json_encode($options), true);
print_r($op);
print('
');

// Attach the field values to the nodes
//$nodes = $results['node'];
//field_attach_load('node', $nodes, FIELD_LOAD_CURRENT, array('field_id' => $field_id));
// Buld the options array based on the query results, overwriting duplicate entries
//foreach($nodes as $nid => $node) {
  //$value = $node->field_cognome_l['und'][0]['value'];
  //$options2[$value] = $value; }

//Alter the field
$form['title']['#type'] = 'select';
$form['title']['#options'] = $op;
$form['title']['#size'] = 1;
}
}

I feel close to solution but I miss something.

On the picture I print four arrays.

Only the 4th was working when I tested the module with a custom field,

so probably I need to transform the 3rd array into the 4th.


texts:
I want to pass a URL to a function. This function should get the node ID from the URL.

How to do this?


texts:
I'm trying to add Zurb Foundation framework to my theme library file. However, when I add the following code to my library, the java script file load without any probleme or difficulty but css files only can not be load.

I would be grateful to hear what is the problem with the code and what is the right way to load a css of the library?

This is my theme folder structure (Zurb Foundation folder location):

|-Theme Name
|  |-includes
|  |  |-foundation
|  |  |  |-css
|  |  |  |-js

Library file:

foundation:
  version: 6.x
  css:
    includes/foundation/css/app.css: {}
    includes/foundation/css/foundation.css: {}
    includes/foundation/css/foundation.min.css: {}
  js:
    includes/foundation/js/app.js: {}
    includes/foundation/js/foundation.js: {}
    includes/foundation/js/foundation.min.js: {}
    includes/foundation/js/jquery.js: {}
    includes/foundation/js/what-input.js: {}
  dependencies:
    - core/drupal
    - core/jquery
    - core/jquery.once

[theme_name].info.yml file:

name: Theme Name
type: theme
core: 8.x
base theme: classy
libraries:
  - Theme Name/foundation
  - Theme Name/global

And finally, I uncheckmark Aggregate CSS and  Aggregate JavaScript files boxes in performance, flush caches and clear my browser cache.

screenshot of Source page:

As you can see the javascript files load witout any problem.


texts: Error while altering js file Undefined index: scope in drupal_get_js() (line 4309

texts:
I need to change javascript code of jCarousel, and I want to create my own function and change it in hook_js_alter(), but it is not working properly, or I missing something.

function common_js_alter(&$javascript) {
  if ($node = menu_get_object()) {
    if ($node->type == 'home') {
      if (array_key_exists('sites/all/libraries/jquery.jcarousel/lib/jquery.jcarousel.js', $javascript)) {
        $file = drupal_get_path('module', 'common') . '/js/jcarousel.js';
        $javascript['sites/all/libraries/jquery.jcarousel/lib/jquery.jcarousel.js'] = drupal_js_defaults($file);
        dpm($javascript);
      }
    }
  }
}

I need to change sites/all/libraries/jquery.jcarousel/lib/jquery.jcarousel.js to drupal_get_path('module', 'common') . '/js/jcarousel.js'. The path is correct, but as I can see with dpm() no scope is enabled and type.


texts: How to manage version control for patched contrib modules?

texts:
I got some great feedback regarding patching contrib modules.

Is there a good way to keep track of patches to contrib modules?
For example, let's say I create a patch for a contrib module and submit the patch to the issue queue.

A month goes by, a new version of the module has been released (without my patch) and I get notified to update to the next version.
If I keep my patch file in the module directory I think it will get wiped out when I do the automatic upgrade?

Should I move the module from sites/all/modules to sites/default/modules to prevent automatic updates?

Does anyone have a good system?


texts: using hook_node_submit to create an alternate upload method

texts:
We have a problem where we are uploading a number of files on a regular basis, the files need to be kept outside of the document root.

Each file is attached to a node.

I created a folder /documentstore and all the files are uploaded to there.

To enable submission of documents I added a symlink sites/default/files/documentstore -> /documentstore

Unfortunately drupal does not allow files uploads to a symlinked folder :( I have modified core to solve the issue as a temporary fix.

For a more permanent fix I'd like to add a module hook node submission and then copy the file to the symlinked folder avoiding drupals core upload function. I am trying to use hook_node_submit().

I would like some hints as to how I can go about this or whether there is a better way to store files outside of the docroot (yes it must be done that way)


texts: Set active trail in hook_preprocess_node

texts:
For some content type, I need to attach my node to a parent menu item. I don't want to do that with UI (because too many nodes).
I saw something like that for Drupal 7 (works in a preprocess):

menu_tree_set_path('main-menu', 'my/parent/path');

Do you know a way to do that with Drupal 8 (menu_tree_set_path seems undefined) ?


texts: Scheduler module- How is the check for publishing done?

texts: I just installed the scheduler module and now I was wondering how the check for publising/unpublishing is done. Is it done by a cron task or is a database query executed at every page load or perhaps something else?


texts: Where to modify the logic that calculates the height of a collapsible fieldset?

texts:
I'm not sure if this is a theme issue, but I continually get my collapsible fieldsets being 1-2 scanlines too short, causing scroll bars to appear.

This project has heavy use of FAPI, sometimes with collapsible fieldsets inside other collapsible fieldsets, and the vertical scroll bars are eating too much page real estate.

I'm using an unmodified version of Fusion Starter theme, if that helps. And, I'm not a themer, but can usually get by.

I would be perfectly happy modifying the PHP or JavaScript code doing this calculation, if I just knew where it is.


texts: SQLSTATE[42000]: Syntax error or access violation (db_insert Function)

texts:
I try to build new module in drupal 7
I try to insert some data in some where inside the code
it was working in many functions
but suddenly when I try to do the following

  db_insert('payment_request')
    ->fields(array(
      'payment_item' => $data['payment_item'],
      'change' => $data['change'],
      'via' => $data['via'],
      'userlist' => serialize($userlisthidden),
      'startdate' => strtotime($data['startdate']),
      'enddate' => strtotime($data['enddate']),
      'hash' => $hash
    ))->execute();

it gives me an error

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'change, via, userlist, startdate, enddate, hash) VALUES ('2', '1', '1', 'a:1:{i:' at line 1

I checked the table and the fields and the values
every thing are correct

so I decide to insert static data like the following :

  db_insert('payment_request')
    ->fields(array(
      'payment_item' => 'qq',
      'change' => 'qq',
      'via' => 'qq',
      'userlist' => 'qq',
      'startdate' => 'qq',
      'enddate' => 'qq',
      'hash' => 'qq'
    ))->execute();

But it gives me the same error
so, what i miss here, please help me


texts: Adding a Taxonomy term in a node via services

texts:
I am trying to submit a node via an android native app in java.  I am using services 3.3, and I am able to login, and submit to a Content type assuming all of the fields are Text fields.

But I would also like to add some taxonomy terms as fields.  The Tax term is already defined on the drupal system.  I have a term NAME: "A". tid:37.

what is the services technique to submit a Tax term?  or even some hints.

I also want to submit some images as well... another question perhaps


texts: How to set page/content title/header from a controller

texts:
I have a custom route and module that outputs content to a page.

I want to also have a page/content title/header on the page. I've figured out how to set the browser title, but I can't figure out how to add the headline title.

When creating a basic page with no custom template, the headline is part of that html. I want to replicate this.

Here is what I have in my controller:

return array(
    '#title' => 'This sets the browser title',
    '#markup' => 'This is the html output',
);

I've been banging my head on this for a few days now... help!

I've already tried setting $variables['title'] in theme_preprocess_page_title, but that doesn't seem to get called. I've also tried it in preprocess_page, but that does nothing.

To clarify - I am wanting to change the text that is by default displayed in <h1 class="page-header"> from within my controller.


texts: Displaying taxonomy terms and its contents with views

texts:
I am quite new to Drupal and I'm having troubles in some tasks.

I need to show food categories and food products as its contents. In order to do that,
To begin with, I created a content type with the field of taxonomy term reference for products and taxonomy vocabulary for categories.

Secondly, I added categories as taxonomy terms and products as content by choosing its related category. Everything is fine up to now.

For the categories page output, I created a view to show categories (taxonomy terms) and set details as below:

Fields
Taxonomy term: Name

Filter criteria
Taxonomy vocabulary: Machine name (= Food Categories)

path: /categories

This page help me to show categories.

For the other page that needs me show each product(content) for the selected category I created another view and set details as below:

Fields
Content: Food Category
Content: Title

Filter Criteria
Content: Type =(Food Product)

Contextual Fiter
Content: Food Category (filed_food_category)

Contextual filter settings are:

When the filter value IS in the URL or a default is provided
Option:   Override title is checked and value is %1

Specify validation criteria
Option: Validator is checked and set taxonomy terms where vocabuary is food categories
Filter value type set to Term name converted to term ID

Option: Transform dashes in URL to spaces in term name filter values is checked

path: /categories/%

This view is able to show me each content related category.
For example when I tried to type /categories/category-1
I can see output through this view properly.

And I needed category titles from the first taxonomy terms page redirect me second view which shows each product under the related category. To achieve this I set url each alias of taxonomy terms as categories/category-name and checked the option of the filed Taxonomy Term:Name as Link this field to its taxonomy term page.

But here is the problem. When I attempt to click link on each food category (taxonomy term) provided by first view redirect me another page while it is supposed to redirect to second view page. After some research I figured out that links on the first taxonomy terms view redirect me default taxonomy page. And I read that it's possible to override default taxonomy page by using some extra module called Taxonomy Display and Display Suite. After installation modules and I follow the insturctions, I found out the option taxonomy terms page display under the related taxonomy vocabulary. I set Associated content display as views and picked related view(second view I created) but I can't get output of second view. I get all content listed(not filtered).

Please help me, I feel very desperate.
Thanks in advance.


texts: Drupal 7 - How to display the TID of a term reference field in a content type?

texts: I have a content type called video and a term reference field called category. I want to be able to output the TID of the term reference field in my content display. Is there a way to do this to expose the TID of the term? I'm able to generate a link from the term in the manage displayed settings, but it has an alias to it so it won't show the tid in the url.


texts: Unable to set drupal_set_message() after logout redirect

texts:
I want to show a message via drupal_set_message() after logout and redirects to page.

Code:

/*
 * Implements hook_user_logout().
 */
function example_user_logout($account){
  $login_message = 'You have been redirected';
  drupal_set_message(t($login_message));
  $login_redirect = '/mypage';
  example_redirect($login_redirect);
}

/**
 * Redirect path for logout.
 */
function example_redirect($path) {
  $response = new RedirectResponse($path);
  $response->send();
  exit;
}

Tried commenting exit also, but still no luck.
Any help would be appreciable.


texts: How to list comments of certain node in a PHP ( preferably in XML / RSS format )?


texts: Is it possible to create a panalized node in code?

texts:
Is it possible to create a Panelized node programatically?

Perhaps something like the following:

$node = new stdClass;
// ... Set other properties
node_save($node)

// Then somehow add panalizer , layout, panels
// Something like:
$panelizer = array ( 'nid' => $node->nid )

//save it
panelizer_save_node_panelizer($panelizer)

// add existing panels/panes to the node
?>


texts: How to remove number of reads under each node?

texts: I'm using Drupal 7. After enabling the Statistics module, I see, under each node, how many times it has been read (e.g. "4 reads"). How can I remove this expression while I'm using it ("Content statistics: Total views") in my views?


texts: How can I add user information to orders administration pages?

texts:
I'm using Commerce User Profile Pane to capture Drupal Users profile fields directly in the Commerce checkout pages : as I have several custom customer fields (birthday, passport number...), I found this more accurate than storing this data in Billing information.

How can I display the collected informations along with the billing information data (name, address), in the order view page : admin/commerce/orders/%, and in the quick edit view ?

I can't find any view or .tpl for such task.


texts: Not seeing file upload destination radios for image field in custom blocks. Where is the fault?

texts:
Scratching my head with this. I am working with a custom block and have added an image field. However the Upload destination radios are not present and this results in a file storage error. ' Illegal choice public in Upload destination element'

Two screenshots attached. The first indicates what I am seeing, the second (from a different site) is how it should look.

I am only seeing this problem with custom blocks and find that regular content types are okay. Not just with image storage; files too.


texts:
Is there a some sort of global preprocessing hook for any link on a Drupal site?

Use case:

I've got an enquiry webform embedded on a node that presets some inputs by URL parameters. Editors can set links to that enquiry node on multiple different places on the site (in navigation menus, inside text fields using LinkIt, in URL fields,...).

Whenever the currently active context is a certain node type (e.g. on every full view of a product like "/product/product-id"), I want all links that are rendered on the page (e.g. menu links, blocks, entity reference field on the product pointing to the enquiry node, etc) to have the product_id appended.

I know how to get the current node id in preprocessing and I do know hook_link_alter for menus. But I wonder if there is some sort of global hook that captures all links, saving me from creating 453 different hooks doing all the same thing.


texts:
I need to enable the 'Aggregator' module on my Drupal 7 website. When I do that, I get a error message saying:

  DatabaseSchemaObjectExistsException: Table aggregator_category already exists. in DatabaseSchema

I researched on this and what it means is that the table for the module already exists in the DB. Now in case of contributed modules I can disable them, uninstall it and make a fresh install and re-enable. I am not sure what can be or should be done in case of core modules.

Any guidance is greatly appreciated.


texts:
How to handle this situation in the Rest Export View as api.

We want to fetch a limit of 20 items in the api and with a load more feature. Currently our api produces hundreds of items.

In the Pager section, I can ofcourse select Paged output, full pager and specifiy  Items to display, say 20. But how this works in the api? Since its only displaying 20 items, how does load more feature occur? Thanks!

This is my Pager settings.

PAGER
Items to display:Full | Paged, 20 items


texts: Which function should I use to update a node through the comment form?

texts:
I use this function to synchronize a comment field with the value from a field that exists in the node the comment belongs to.

function mymodule_comment_create(\Drupal\comment\CommentInterface $comment) {
  $node = $comment->getCommentedEntity();
  if ($node && $node instanceof \Drupal\node\NodeInterface) {
    if ($node->hasField('field_example')) {
      $comment->subject->value = $node->field_example->value;
    }
  }
}

How could I achieve the opposite? When a comment is submitted with the field field_rating, the field_average_rating field of the node should be updated.

How could I achieve that?


texts: How do I make the title field in views as the title of the block?

texts:
So how do I make the field "title" also show in the title of the block? Thanks.

Here is the image of the view: http://i.stack.imgur.com/jyUmo.png


texts: Previewing a view does not show a phone number but when I look at the view by visiting the URL of the page it does?

texts:
I have taken over a Drupal website and I am completely new to Drupal. One of the features of the website is to list out all the employees of a company (a Directory).

The directory is displayed with a tabled view, and is pretty easy to understand.

When I look at the view while editing it in the preview view I don't see the each employees' list of phone numbers, I dont see a field for those numbers (i.e. Content:Phone_Number) either, but when I actually look at the view, from visiting the URL of the page I see the phone numbers.

Additionally, when I visit the URL that is hosting the View and use Firebug (DOM Explorer) I can see that there is a td tag that is holding the phone numbers. But, when I visit the View from a editor standpoint and check the preview view with FireBug (DOM Explorer) I see that exact td tag, but it's holding the user's NID number, not the phone numbers!

How is this possible?

Please and THANK YOU.


texts: Untag/Remove a taxonomy term from a node

texts:
I am inserting and updating node programmatically in drupal 7.When am updating I want to delete the taxonomy terms tagged in that particular node and have to insert new terms.

Please help me to untag the taxonomy terms of that node.the unset($node->taxonomy_field) is not working.Can anyone help me?


texts: Aplying image styles to images return 404 for images

texts:
When image styles are aplied to images the modified images are not created and the image url returns a 404 error.
I've been checking for solutions and none worked for me. I commented the Options +FollowSymLinks in the .htaccess
(https://www.drupal.org/node/1170440), I changed the files folder permissions to 777, I changed the theme and back... (image style (imagecache) images are not being created), and still nothing.

The worst part is that it was working fine until yesterday (at least i found it yesterday) and many of the pictures have their modified versions working, but not the new ones for which the url returns de 404.

Is there any thing I can do that I've not tried yet?

Thank you


texts: Presenting a menu within page content with associated descriptions and images

texts:
Currently, I have a drupal project where I have two levels of menus. (So for example, the top menu has "home" "about us" "faq" etc.) each top level menu has a secondary menu.

I'm trying to create a node for each top level menu item that is an 'overview' of that category. One of the things that I'd like to do on each overview page is provide an expanded version of that secondary menu in the content area, where instead of just having links, we would also have a description and an image associated with each menu item. (So on the "About Us" page, there would be a link to the "About Us-> History" page, and this link would have an icon and a description). Ideally, I'd like to lay these out as a set of horizontally spaced squares below the content area.

Currently, I'm managing this by creating a custom block for each link/image/description combination, and using Context to toggle the appropriate blocks on and off, but this seems really inefficient and error prone. Can someone recommend a 'correct' way to do this?


texts: Executing jQuery code during form submission

texts:
I developed a module to show an "End" button on the node edit form, and it works fine.

function renew_form_alter(&$form, &$form_state, $form_id) {
  $form['actions']['property_endlease'] = array(
    '#type' => 'submit',
    '#value' => t('End'),
    '#access' => TRUE,
    '#weight' => 15,
  );

  return $form;
}

I want that, when users click on that button, some fields are changed from jQuery code.

I tried the following code, but it doesn't show any alert, even though the form is submitted.

jQuery('#edit-property-end').click(function (event) {
  alert('');
});

I want to submit the form after the jQuery code is executed.

Does anybody have an idea on how to do this?

Thanks


texts: How to translate 'ago' in interval time formatter in views?

texts:
Googling the only thing I've managed to find is: https://www.drupal.org/node/2800563

What can I do to translate 'ago' or omit it from printing?


texts: Is it possible to make a site aware of entity schema changes that are managed externally using SQL-based storage?

texts:
Consider the following situation:

A Drupal 8 site using native SQL-storage (MySQL)
custom_table is added to the same MySQL host as Drupal, either as a table in the Drupal system DB or as a table in a separate DB on the same host (Drupal supports either as the basis of a new entity). This table is the base_table of a custom content entity (custom_entity) as declared in custom_module. The entity is defined by extending \Drupal\Core\Entity\ContentEntityBase.
Individual columns from custom_table are also mapped directly to Drupal fields on custom_entity using the baseFieldDefinitions() method in the entity definition.
The custom_table is not declared in custom_module's hook_schema() because it is managed by external tools and may even have CRUD operations on it external to Drupal. The persistent_cache is disabled for custom_entity to account for this.
custom_module is installed. The install routines automatically create entity/field storage definitions and related schema definitions as part of the installed state based on the custom_entity definition.
custom_table grows full of data.
The schema of custom_table needs to be updated (e.g. a new column added and mapped to a new custom_entity field, length increase to existing varchar string, etc.)

Because the schema of custom_table is not managed by Drupal how can Drupal be made aware of the schema updates in a way that is compatible with the native SQL entity and field storage that custom_entity uses?

Possible Approaches

Some ideas discussed in forums (here, here and the "Updating an existing entity type" notes here) involve ad-hoc workarounds such as direct updates to key_value DB records that seem dangerous.

TheEntityDefinitionUpdateManagerInterface seems to serve as a central place to deal with updates of this nature, but it also appears to couple updates to storage/schema definitions with the deployment of changes to actual DB schema. That said, I have had some success with snippets like this after updating the custom_entity definition appropriately:

$entity_type = \Drupal::entityTypeManager()->getDefinition('custom_entity');
$entity_definition_update_manager = \Drupal::entityDefinitionUpdateManager();
$entity_definition_update_manager->installEntityType($entity_type);

However, this method is documented for once-off use (not ongoing re-install use) so this feels like inappropriate use with possible side-effects.

I have also experimented with the entityDefinitionUpdateManager ::updateEntityType() and ::updateFieldStorageDefinition methods, as those appear safe to re-run, but they do not seem to update the installed schema definition appropriately.

I also suppose that a custom entity storage definition could be justified to deal with all this, but I assume that would require re-defining or re-wiring quite a few dependencies (notably the low-level SQL management) that otherwise work well with the native entity storage.


texts: How to display an individual list of user created nodes?

texts:
I'm having a block on the front page with a list of users displaying their profile fields like: picture, full name, e-mail etc. I achieved this by simply creating a User View in Views displaying it as a block.

Now I want to add an extra option to it that gives a list of the user's created node articles. So that their articles (per user) will be visible as a list and displayed like the profile fields.

I've tried several ways but all to no avail. The following approaches got me close:

Made a relationship "User: Representative node" and added a Node Title field to the View with this relationship. The way this relationship works is what I actually want, I think. The thing is: it obtains a SINGLE representative node for each user but I want to obtain ALL the nodes for each user.
Made a seperate user View (block) with relationship "User: Content authored" and contextual filter "Content: Author uid". Having the Node Title as a field again. I tinkered a bit with the contextual filter and setting it with "User ID from logged in user" gets me a nice list of nodes of the logged in user. But that's not what I want, I want to show all content of each user separately. Providing a default value "User ID from URL" gives me nothing. Probably because the block is on the frontpage.

Can anybody tell me what's the solution, or just give some ideas? I'm on it for days now and I'm out of ideas.


texts:
============================================================================

Error executing action run on resource 'execute[drupal-make-drush-install]

   ============================================================================

Mixlib::ShellOut::ShellCommandFailed

Expected process to exit with [0], but received '2'
   ---- Begin output of composer global require drush/drush:dev-master ----
   STDOUT:
   STDERR: Changed current directory to /root/.composer
   ./composer.json has been created
   Loading composer repositories with package information
   Updating dependencies (including require-dev)
   Your requirements could not be resolved to an installable set of packages.

 Problem 1
   - Installation request for drush/drush dev-master -> satisfiable by drus

/drush[dev-master].
       - drush/drush dev-master requires php >=5.5.0 -> your PHP version (5.4.1
) does not satisfy that requirement.

Installation failed, deleting ./composer.json.
   ---- End output of composer global require drush/drush:dev-master ----
   Ran composer global require drush/drush:dev-master returned 2

The available php-cli package version for centos is 5.4.16 so which version of drush should I install?


texts: Why is "drush cc all" failing with "undefined function user_load()"

texts:
After updating my Drupal test server to have a fresh copy of the database and code from the production system, "drush cc all" would fail with a message saying

  PHP Fatal error:  Call to undefined function user_load() in /usr/share/pear/drush/includes/drupal.inc on line 138

I'm running drush version 6.2.0 with a drupal 7.25 system. I'm using memcache as cache_default_class.


texts:
For some reason, I need to truncate the users table, but I don't want to remove the user with ID equal to 1.

Is there any way to do it?


texts: How to count the node a user has created in a View?

texts:
I created a view to show Users. These users can create nodes of the "Questions" content type.

The view has to render a table to show how many (the total number) Questions the user has created. Something like:

User +++ Questions created
John --- 10
Ted  --- 4
Alf  --- 19


texts: It sounds quite easy, adding a checkbox to Ubercart's checkout form. The consultant I spoke to told be to use hooks, or try using the uc_extra_fields_pane module, which I also cannot get to work properly (it's config page is not showing up). I'm using Ubercart 2 and Drupal 7.22.


texts: How to remove default div of views block?

texts:
My html code:

    &rarr;

<img class="img-responsive" src="<?php print base_path(). path_to_theme();?>/assets/images/img.jpg" alt="">

In views-view-fields--name--name.tpl I'm using this code:

    &rarr;

<?php print $fields['field_fieldName']->content;?>

The generated output is the following.

    →

## I have to remove this div

I have to remove the default
 before the  tag.


texts: Space at end of URL still resolves, but url-specific blocks do not appear. Why?

texts:
A newsletter went out with a link in a banner containing an errant space at the end:

<a href=“http://www.mysite.com/my-landing-page “>

Depending on the browser, the URL was either encoded with the “%20” at the end or the space was left unencoded. Either way, the URL was resolved: The page was found and the landing page displayed. However, the sidebar blocks, which were set to only display at certain URLs, did not.

I tested on some other websites, and it’s apparently a Drupal thing; I can create 404s on other non-Drupal sites by adding a “%20” at the end of a good URL.

Why was Drupal able to still display the page, but not the blocks?


texts: How to grant User Points equal to the price of a Commerce Product?

texts:
I would like to grant User Point to product owner in amount of product price after a product is sold.

For this I defined a rule as below:

Events: Completing the checkout process
Actions: Loop (commerce-order:commerce-line-items)

And I defined a Rules Component as below:

Conditions: Entity has field (Entity: commerce-line-item, Field: commerce_product)
Actions: Grant points to a user: (User: commerce-line-item:commerce-product:creator, Points: commerce-line-item:commerce-product:commerce-price:amount)

But when I save component it generates this Error message:

  Data selector commerce-line-item:commerce-product:commerce-price:amount for parameter points is invalid.

How I can do that?


texts: Custom content type on registration form. No node title field

texts:
I set my custom content type to show on user registration form. I see cck fields, but I don't see node title field (required field) :(

Could somebody give any advice?


texts: Using a Service globally in a .module file

texts:
I want to use a Service globally in a Drupal 8 .module file.
The service' name Manager.

in my_module.module I want to able to:

function some_function() {
  $data = $manager->someMethod();
}

i.s.o

function some_function() {
/** @var \Drupal\my_module\ManagerInterface */

  $manager = \Drupal::service('my_module.manager');
  $data = $manager->someMethod();
}

I know how to do it in a controller using $this. But because the code depends heavily on Drupal hooks, I have to access the Manager (many times) from within the .module file.

I have seen this: Making an instantiated object in a module global but it refers to Drupal 7

EDIT:
After getting some the basics of D8 and OOP I realize now that what I was trying to do here is to dependency inject the service my_module.manager into the my_module.module file, which is not possible.
Good reason to refactor the code as much as possible into Classes.


texts: what json structure does simple oauth expect?

texts:
Drupal 8.
I'm new with simple Oauth.
I had manage to do this:

But I want to do it with the Raw format, cuz my frontend is in Angular, so I will send a Json to Drupal.

This is my first try:

{
    "grant_type":"password",
    "client_id":"f011cc58-40ce-43a9-8f71-842494e3a997",
    "client_secret":"abc123",
    "username":"test",
    "password":"test"
}

And this is the response:

  {
      "error": "invalid_grant",
      "message": "The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid,
  expired, revoked, does not match the redirection URI used in the
  authorization request, or was issued to another client.",
      "hint": "Check the configuration to see if the grant is enabled." }

I have set up the Content-type: Application/json but I got the same result.

Any idea??


texts: Drush error when attempting Drupal update: unable to copy/move

texts:
I have a Drupal site running on localhost (Windows) that I'm trying to update from 8.6.7 to 8.6.15.

When using Drush to perform the update (drush up drupal -y), I encounter the following error:

Unable to copy C:\Users\USERNA~2\AppData\Local\Temp/drush_tmp_1556533742_5cc6d1ee1cacf/drupal-8.6.15 to
W:\htdocs\site-name\www/drupal-8.6.15.
Unable to move C:\Users\USERNA~2\AppData\Local\Temp/drush_tmp_1556533742_5cc6d1ee1cacf/drupal-8.6.15 to
W:\htdocs\site-name\www/drupal-8.6.15.
Updating project drupal failed. Attempting to roll back to previously installed version.
Backups were restored successfully.

I've tried:

clearing Drush's cache (drush cc drush)
updating Drush (via composer) (now running Drush 8.2.3)
clearing Drupal's caches

But the problem remains.

This problem does NOT occur when updating modules. Only Drupal itself.

I checked the C:\Users\USERNA~2\AppData\Local\Temp folder while drush was working, and I was able to confirm that the drush_tmp_1556533742_5cc6d1ee1cacf subfolder was indeed present for a time (containing the Drupal .tar.gz and its upacked folder). So there's no issue in writing in this folder.

Any idea what causes this and how to solve it?

Thanks in advance.


texts:
I've a field collection called program, in which it have 2 fields date and time.

I've created a tpl file for the field collection and it is rendering the content as well. But the issue is, it is showing the first value entered the number of times field collection has been added.

What am I doing wrong. I've just copied the content in field-collection-item.tpl.php to my tpl.


texts: Toolbar to insert HTML tags while editing content

texts:
This very site features a neat toolbar just over the textareas in forms, where clicking on "B", for instance, will spawn **strong text**, abstracting away the need to know Markdown.

Is there a way to do the exact same thing with, for instance, filtered HTML, or another text format based on HTML, on my Drupal site? I find that WYSIWYG editors tend to bloat the actual code and I want my users to get used to seeing HTML tags, but for the moment they can't be bothered with typing the markup in themselves.


texts: How to redirect to a different URL based on node content while loading a node

texts:
I have a site that uses the webforms module to gather user information. On the front page there is a list of previous submissions. Each of which has a link to view the submission (generated by Views module)

Link is like thingie.com/node/115/submission/1763

However, some users are saving the form as draft and coming back at a later date. When they get to the view page they aren't noticing they can click on the edit tab and are filling in a second submission. So we're getting 'weird' duplicates and they're wasting time.

As the submission view node is loading I'd like to check if it is a webform; which is in draft; and they are the submitting user. If so I'd like to redirect them to

thingie.com/node/115/submission/1763/edit

I think know how to do the redirect and the test but I'm being slow and am not sure what hook to catch.

I'm about to investigate the node load hook but wondered if there was a better way.


texts: Almost raw Views output display style plugin?

texts:
Has anyone came across a Views display plugin that outputs a very modestly themed markup? I mean:

no wrapper elements,
no need to visit each sub-dialog and turn off wrappers, just the minimal output such as link when asked to link, or list items and ul/ol when asked to output a list,
no template overwriting (usually involves at least 2 files).

I'm not comfortable with writing and debugging raw database queries (which would be the most tempting tactic), neither am I with doing repetitive markup templating. That's why I guess such a display plugin might make sense. Anyone?


texts: After crash I can't access certain sections nor login to site

texts:
I'm working on localhost. After saving a view the loading icon kept going for about 15 minutes. I changed over to other admin sections and they were fine, but after coming back to the original view the loading icon was still there. My clever answer was to log out and log back in to see if this fixed it. Oh terrible mistake, now I can't log back in, the page stays loading for a long time until finally returning a blank page. Being logged out I can still view the site's sections EXCEPT the view that crashed, that page just hangs.

I'm on a tight schedule so reinstalling would be my last option. Anyone has experienced this, how can I fix it from 'outside'? I'd appreciate any help, I'm growing desperate.

Thank you.

EDIT [SOLVED]:

Not much of a solution but I ended up restoring the DB with a backup file (luckily I had backed it up early today!) and the site works fine again.  I couldn't post this as an answer because I don't have enough reputation.


texts:
How to redirect the user to a product page (node) after payment is made?

I'm using the Commerce Express Checkout module. That's why in the Shopping cart can be just one product.


texts: How to use Form API and and node_submit to insert taxonomy data

texts:
I have a content type with a number of text fields and a field linked to a taxonomy vocabulary with about a dozen terms.

I have successfully developed code using the Form API to insert data from my custom form into my node using node_submit for the text fields.  A sniped of the code I use is for the text fields is:

$node->field_s_phone[$node->language][0]['value'] = $form_state['values']['phone'];
$node->field_s_email[$node->language][0]['value'] = $form_state['values']['email'];

node_submit($node);
node_save($node);

I would like to implement a single set of checkboxes of my vocabulary terms on the custom form, then pass the values using node_submit in a similar fashion to the text fields (sort of like):

$node->field_catagories[$node->language][0]['value'] = $form_state['values']['catagories'];

I would be grateful for any thoughts or insight.

Thanks,
Bill


texts: load files to the public files dir via admin panel?

texts:
I was wondering if I could get some advice on best practice on loading images directly to the public files DIR - without FTP access?

My site lives on cloud hosting, and I have no FTP access, my code pushes go through git, but my files dir is not included in the git repo.
I have to load a couple images that are not part of any content type to the public files dir, and don't know if there is a module for that, or what other best practices may be.
I can put a support ticket in if I have to, but I'd like to see if I can get around that if it's possible

Thanks!


texts:
I am using theme settings in my Drupal 7 theme to provide a theme option as follows:

$form['layout']['body_image_position'] = array(
  '#type' => 'select',
  '#title' => t('How should Body Image be Positioned'),
  '#options' => array(
        'body_image_position_right' => t('Image on Right'),
        'body_image_position_bottom' => t('Image on Left'),
        'body_image_position_left' => t('Image Below'),
         ),
  '#default_value' => 'body_image_position_right',

);

I then use theme_get_setting('body_image_position') to call the value of the setting.

Using this command returns the 'machine name' of the setting (e.g. 'body_image_position_right '). But I want the 'friendly name' (e.g. 'Image on Right'). How can I do this?


texts:
I have to display number of item in cart/basket in design where I can't use the menu. So my question is...how to access number of item of cart at theme level?

Is there any function for template file which can return me this, so that I can show it in page.tpl.php ?


texts: Views field product link does not link to correct language

texts:
It seems that, no matter how the view is configured, the product link field always links to the default language even if user is viewing the page in a different language. However, the product title field with link to product checkbox enabled goes to the correct language page.

Is this a bug, or am I doing something wrong I can double-check?


texts: Admin gets logged out when looking at user profile

texts:
Every time I log in as admin and view a user profile, Drupal treats me as that user.  This is beneficial.  However, in order to return to the admin panel I need to log out of that user account and log in again as the admin.  What's going on here?  What mechanic causes this to occur and can I turn it off?

For the record, this is Drupal 7

Edit:
This is happening when I redirect the admin to a page usually restricted to special users.  Such as mysite.com/user or mysite.com/vendor_orders which is a special page I created in my own custom module.


texts: Adding the contextual link render element

texts:
I have render array like this.

$array = [
  '#theme' => 'theme_wrap',
  '#content' => $data,
  '#contextual_links' => [
    'my_module' => [
      'my_module.router.name', $pid
    ]
  ]

and theme-wrap.html.twig

{%
set classes = [
'contextual-region'
]
%}
<div {{ attributes.addClass(classes) }}>
  {{ title_prefix }}
  {{ title_suffix }}
  {{ content }}
</div>

and file mymodule.links.contextual.yml

mymodule.admin.edit:
  title: 'Edit'
  route_name: my_module.router.name
  group: my_module

and route name my_module.router.name exited and working. Render data array working but don't see contextual link.

Update: I have a form to user can enter input. After submit i'll show data from user. And simple controller return array above.
- I have insert {{ title_suffix }},{{ title_prefix }} class contextual-region but don't working.

I was doing something wrong?
Please help!


texts: How to select a shipping box for a particular product based on quantity using Drupal Commerce?

texts:
I have two shipping rules for a particular product.

Case 1. (Shipping box)

Quantity: 1-12
Width: 6
Height: 6
Length: 8.75
Weight: 3

Case 2. (Shipping box)

Quantity: 13-24
Width: 8
Height: 6.5
Length: 11.25
Weight: 4

When a user purchases this particular product, if the quantity below 12, use Case 1 shipping dimensions. If greater than 12, use Case 2.

Anyone can point out how to achieve this? I'm using Drupal Commerce with Commerce FedEx as shipping service.

There's a tutorial on how to achieve something like this but it uses flat rate and not any shipping box dimensions.


texts: Best module where you create a block and select a node from drop-down to render?

texts:
It's been a short while since I played with Drupal 6 and now I'm getting my feet wet in Drupal 7.7.

I need to be able to create a simple block and in that block 'configure' area I want to be able to simply choose a node in the system from a drop-down list. When that block renders on XXXX page, it will then render the teaser for that node along with any other variables set.

I thought I could do this with Views 3.x by just creating a block view which only renders one result and takes a node title as an argument. The new Views 3.x interface has me a little confused though. Not quite sure how to set it so the node title argument is configured in the block admin area and that argument is then always passed with the block view renders.

I guess what I sort of was looking for was an exposed filter in the block admin edit page where the value is saved but that doesn't seem possible. Anyone have any module suggestions?


texts: How to add more field columns using Inline Entity Form table display

texts:
I was wondering if it is possible to have more columns in an Inline Entity Form table to show things like serial numbers and make/model after I input the Node ID. I was reading the answers from this question but I am confused on how to make these work. But in the end I would like the table to look similar to this:

For example, I would like to be able to input the existing Inventory number (node) and when I click "add" it will display the make/model and the serial number (if this is even possible). Which will then be saved as a Sales Order.


texts: how to Add new Role employer also display in url like user/employer?

texts:
the default roles anonymous user, authenticated user, administrator and i want to add new role  employer i did it people -> permissions -> roles -> add roles.
i want to create new sign up web form that employer user ? and i want URL like user/employer


texts: Get Absolute url using hook_preprocess_node

texts:
We are attempting to change the $variables['url'] from a relative to absolute URL within the mymodule_preprocess_node() hook. The $variables['url'] is displayed as a <a> element within our node--page.html.twig template.

How can we set the $variable['url'] so that it uses the absolute URL?

node--page.html.twig

<a href="{{ url }}">
  {{ label }}
  {{ content.field_text }} {# custom text field #}
</a>

What we tried within mymodule_preprocess_node().

use Drupal\Core\Url;

function mymodule_preprocess_node($variables) {
  $options = [
    'absolute' => true,
  ];
  $variables['url'] = URL::fromUri($variables['url'], $options);
}

This results in the following error message:

  The URI '' is invalid. You must use a valid URI scheme. in Drupal\Core\Url::fromUri() (line 281 of core\lib\Drupal\Core\Url.php).


texts: How can i add .pdf extention on the default upload files

texts:
When i create an article i saw that i'm allowed to upload image files only

  Allowed file types: .png .gif .jpg .jpeg

How can i add .pdf file extension and attached with the article?

I'm using zen theme


texts: Multiple teaser displays of a single content type on a single page

texts:
I am new to Drupal and am working on my first project.

I have a Views frontpage with a grid layout of teaser displays of recent posts of a single content type. I would like the background of the teasers to be determined by their taxonomy tags. For example, all teasers for content 'A' tagged with 'x' will have a blue border while all teasers for content 'A' tagged with 'y' will have a red border.

Creating multiple content types seems very inefficient as everything else would be the same and only the borders would differentiate them.

I am using the following modules: Views, Display Suite, Context, and Context PHP to accomplish this. Unfortunately, I have no PHP skills and trying to learn PHP in tandem with identifying Drupal and Module variables and classes is not proving an efficient approach.

I was thinking that approaching this with Context 'conditions' for each taxonomy tag for either a 'div' class or for all html 'article' tags (by way of Display Suite I can choose to use an HTML 'article' tag as the layout wrapper for all teaser displays) and a 'theme HTML' reaction will accomplish what I want. The 'theme HTML' reaction will have to be invoked for each teaser display (one page load multiple 'theme HTML' reactions). How can I set a Context condition that selects either a 'div' class or 'article' tag?

Is this even possible? Is there a better way? Any help would be greatly appreciated. Thank you.

I am using D7.


texts: What does the 'property_type' key do in hook_field_info()?

texts: If you look at the hook_field_info() from Physical Fields the returned array has two keys that aren't mentioned in the documentation: property_type and property_callbacks. Can anyone explain what these are for? (Bonus question, are there any other missing keys in the documentation?!)


texts: Hide certain nodes in view listing for anonymous users

texts:
I am trying to restrict node access for anonymous users based on a custom field.
I got it working for accessing the node directly like this:

$country = "GB";
if ($node->hasField('field_country_hide')) {
  $country_code = $node->field_country_hide->value;

  if ($country_code == $country) {
    // this user should not be allowed to see this article
    return AccessResult::forbidden();
  }
} else {
  return AccessResult::neutral();
}

But this doesn't restrict access for the node in a view listing.
What is the best way to go about hiding a node in a view listing?


texts: How to subscribe a user to a group when the OG context is in the commerce order?

texts:
I'm trying to allow people to subscribe to an organic group when buying a specific product.
The thing is that I need to set the OG context in the order, not the product or anywhere else.

Use case: The anonymous user completes an order. The site admin reviews it and then he may or may not grant the anon user the access to a specific role from a list.

How I´m trying to accomplish that:

I've installed Drupal Commerce, Rules and Organic Groups.
I create an OG audience field inside commerce orders (*og_group_ref_commerce*).
I set a rule with some conditions (if the order is set to "completed", and if the user is an anon...) and some actions (a loop to create the new user and assign him a role).

And I'm adding a special action (which doesn´t work):

Subscribe user to group

  User Data selector: account-fetched:0 Group Data Selector:
  commerce-order:og-group-ref-commerce:0

I´ve tried another way, without any success:

  User Data selector: account-created (in and outside the loop that created the user) Group Data Selector: site:og-context--node

Note: As the order doesn´t initially have the group audience context, I have to edit it in order to assign it a group. After saving it (it is still in "pending" status), I edit it again to change it to "completed".

Any ideas?


texts: Restrict acces to file field only to certain role

texts:
I have a node-type called "download" that has a field "file" with unlimited entries. Those files are already stored inside a private path. Now I want to restrict access only to a certain role. I already tried field_permissions but when I enable View field_file, regardless of content author. and grant that permission only to authenticated users, I still can view/download that file as a guest. What am I doing wrong here?

Besides it would be nice to set permissions on a node base. Like "This Node is only Viewable by Role XYZ".

Thanks for any hints!


texts: What can cause form API to ignore the weight of an element that is a collection of buttons?

texts:
I have two form elements on a node form I'm trying to order unsuccessfully. One is a standard collection of form buttons (submit, delete, etc) and another is a fieldset add by CCK. I am trying to order the submit button (one of the buttons in the collection) above the fieldset. I've set the #weight on the button collection (the parent form element of the submit) to a number lower than the #weight of the fieldset.

I've verified that after the #pre_render calls in drupal_render() the weight values I set earlier in my hook_form_alter persist. So nothing has changed them up to this point. I can confirm that changing the weight on the fieldset does it move it around, so I am having some impact on positioning.

Why does FAPI ignore the weights and still position the submit button at the bottom of the form? Or is there another point after drupal_render() that allows other modules to change form element weights?


texts:
I have an email field in a webform that will trigger a rule that checks against that field against a user's email.  The issue is, rules is case sensitive so if the webform field had capitals, and the user's email does not, they don't match like they should.

In webform validation, there are two options that should work for me to force the email to only contain lowercase values.

Regular expression, case-sensitive
Validates user-entered text against a case-sensitive regular expression. Works with: email, hidden, number, textarea, textfield.
Regular expression, case-insensitive
Validates user-entered text against a case-insensitive regular expression. Works with: email, hidden, number, textarea, textfield.

Which one of these should I use, and what is the regular expression so that it only disallows capital letters?

Thanks!


texts: Other related content block using taxonomy

texts:
I have a content type call "procedure" and a taxonomy vocabulary call "services". I was able to build a block using Views that will show me all the related nodes sharing the same term from the vocabulary "services".

Now, I want to build a block showing "other procedures" that will list the nodes not sharing the same term, but having terms from the same vocabulary "services".

Note: in the first block I use the "Has term ID" argument and the "NID" argument.

I don't see how can I "negate" an argument. What am I missing?


texts:
I'm just starting a responsive theme based on Omega, concentrating on the mobile layout at first.

There are certain blocks that will probably be deemed too 'heavy' to include on the mobile layout, and other blocks that will need to be introduced specifically for that layout (watered-down menus, toned-down user-bar etc).

I could easily hide the unwanted blocks on the mobile layout with CSS, and include the mobile-specific blocks on the default layout and hide those (so they're only shown for mobile), but that seems like quite a backwards way of thinking about it. If the blocks aren't shown, the extra overhead they incur would really be unacceptable (especially considering the number of extra db queries that the content in hidden blocks would add).

I'm thinking there must be a nice clean way to intercept the block decision-making process early on in the page build, and exclude/include blocks based on some os-detection, but I'm drawing a blank on how that might be possible.

I'm also going to throw in the fact that Varnish is running in front of this site, which should make things more fun :)

Are there modules/known strategies out there that can help with this?

I should add that using the Context module isn't an option as the site is already fully-fledged, and moving it into Context would be a massive undertaking at this point.


texts: How to point a menu link at a View with multiple options on the same exposed filter selected?

texts:
I've got a view page that serves like a catalog, using many exposed filters.

I want a menu link that points to a certain combination of filters. Let's say the URL for this filtered view is>

  view?option[]=7&option[]=12&option[]=14

Sounds simple, but I'm finding this difficult for a number of reasons:

Menu considers this an invalid path
I can't turn it into a path alias, because that also considers it an invalid path
I can set it up as a redirect, but Menu still won't recognise the redirect as a valid path
I can set it up as a Page Manager page using cTools' page manager, and set that to act as a redirect, but every parameter except the last one gets chopped and it redirects to this. It seems like it doesn't like the ampersands:

  view?option[]=14

If I input it with the ampersands URL encoded, it gets confused because it double URL encodes the URL encoded characters, breaking them.


texts:
i'm using a view thats pulls data from a certain node via refference and i show non logged in users a error that they need to login, but i need to show a special node/add link with the nid in it. i'v got the code and it works without the if statement, in the if statement, my code is not working..

<?php global $user;if (!$user->uid){print '

Oops!

tekst hier

';}else{
 (arg(0) == 'node' && is_numeric(arg(1))) {  $nid = arg(1);print 'Voeg een album toe!';} ?>

<?php  if (arg(0) == 'node' && is_numeric(arg(1))) {  $nid = arg(1);print 'Voeg een album toe!';} ?>

the code above works, but not when its in the if/else block...

Please note that i don't have great knowledge about php.

Thanks!


texts:
Where are services saved?
With Drush cr they are read, but I do not understand where they are saved
(In non-database I find them)


texts: How do I add JS files inside libraries conditionally based on versions of IE7 and IE8?

texts:
In Drupal 8, how would you load a JS file inside a library to only load on IE8 but not lte IE7?

I have the following added which correctly loads only on IE8 and lower.

js:
    js/script.js: { browsers: { IE: 'lte IE 8', '!IE': false } }

But, how would I only load this on IE8? and also how would I load a different js file for IE7? Would this work for example:

js:
    js/script.js: { browsers: { IE: 'IE 7', '!IE': false } }


texts:
I have a product with a custom field, according to this. I know I can create product with

$cp = commerce_product_new('product');
$cp->is_new = TRUE;
$cp->revision_id = NULL;
$cp->uid = 1;
$cp->status = 1;
$cp->created = $cp->changed = time();
$cp->sku = $product[sku];
$cp->title = $product[name];
$cp->language = LANGUAGE_NONE;
$cp->commerce_price = array(LANGUAGE_NONE => array( 0 => array(
 'amount' => $product[sale_price] ? $product[sale_price] : $product[retail_price],
 'currency_code' => 'USD',
)));$product[retail_price];
commerce_product_save($cp);

but I have some custom field.

How can I create a Drupal Commerce product programmatically with full custom fields?

Is  $cp->myfield1='22'; sufficient?


texts:
I want to get the uid of a logged in user in an external php script. I am using:

chdir("C:/xampp/htdocs/mywebsite");
require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

$account1 = user_uid_optional_load();
echo $account1;

But it always return :

  stdClass Object ( [uid] => 0 [name] => [pass] => [mail] => [mode] => 0
  [sort] => 0 [threshold] => 0 [theme] => [signature] =>
  [signature_format] => 0 [created] => 0 [access] => 0 [login] => 0
  [status] => 0 [timezone] => [language] => [picture] => [init] =>
  [data] => [roles] => Array ( [1] => anonymous user ) )

irrespective of admin, authenticated or anonymous user. I also tried these but the result remains same.

global $user;
echo $user;

$account1 = user_load(array('name' => check_plain($name)));
 echo $account1;

I also checked a similar problem and uncommented $cookie_domain = ''; ( blank cookie domain for localhost )in my settings.php but to no avail. How can I get some non-zero uid for logged in users ?


texts: Views Remember Last Selection Back Button D8

texts:
I am having trouble with "Remember last selection" on views in D8. If I click a link away from the view and click back it does not remember my last selection. If I then refresh the page it does. This view does use Ajax and I cannot change that. Also I read somewhere that it may be due to caching from the headers.

If so what is the best way to add / change headers on a View response?


texts: How does one add a new base field to a content entity?

texts:
I'm currently porting my contributed module to Drupal 8, and sometimes I realize I've chosen the wrong field type. I also know that I will need to add additional fields later on, and it would be nice to avoid having to uninstall and reinstall the module every time I do this.

I looked at Add field to existing content entity, but it did not seem to be the actual question.

My question is basically: what's the equivalent of similar D7 update.php code with D8 and entities?

<?php
function MYMODULE_update_7101() {
  db_add_field('mymodule_table', 'some_new_field', $field_schema);
}
?>


texts: Can Search API filter "Index full entity" be used in Search API views?

texts:
I have set up a Solr index for user profiles on my site with the Search API Solr Search.  The profiles are pretty complicated-- several relations, lots of fields, and many theme templates to render them with complex logic.

I am trying to speed up the performance of my search views, and I found this option under Data alterations on the Solr index:

Complete entity view

Adds an additional field containing the whole HTML content of the entity when viewed.

I thought I could use this as a cache by saving the rendered HTML to Solr for the user profiles, and then, in my view, I could just display this one item, the complete entity view, instead of having to configure all my fields and views formatting templates.

So, I did the following:

At /admin/config/search/search_api/index/MYSEARCH/fields, I selected the field for indexing (complete entity view) as fulltext.
At /admin/config/search/search_api/server/MYINDEX/edit, I turned on "Retrieve result data from Solr" as noted in this D.O post.

When I do this, I can now select the "Complete entity view" under Fields in the Views UI, but no result (no HTML output) is returned in the display.  How can I add the output of the "Complete entity view" in Views?


texts:
I have an Entity taxonomy Reference field in my content type.

I need to print parent of the term linked to my node in node.tpl.php (link to that term). How can I do it?

Thanks for your help.


texts: Views tagging question (bulk update tags)

texts:
We have a few taxonomies and don't want users to spend time tagging content. Ideally, we would like to have a view where we could tag content without opening each node.

A module exists for exactly this purpose in D6 but nothing in D7.

http://drupal.org/files/images/views_tagger_screenshot.png

Is there any other way to accomplish this??


texts: How to get accurate information about available security updates after End-of-Life?

texts:
For a Drupal 6 site that use the update module, the "Available updates" report no longer shows accurate information about available security updates.

Of course, this is because after Drupal 6's End-of-Life date, all Drupal 6 modules on Drupal.org were marked as unsupported.

Is there any other way to still get accurate info about available security updates for Drupal 6?